diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-02-29 00:51:29 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-02-29 00:51:29 +0000 |
commit | 6278d373c1a564ae4233a2e4b6d428a9f6202728 (patch) | |
tree | 831ea6ce3ce84ab59e040cc7d176067962b33d5d | |
parent | abacca30f29df84d9818cd1395449eff0e4ee171 (diff) | |
download | pango-6278d373c1a564ae4233a2e4b6d428a9f6202728.tar.gz |
Add functions to convert font descriptions to and from human-readable
Mon Feb 28 19:46:35 2000 Owen Taylor <otaylor@redhat.com>
* libpango/fonts.c libpango/pango-fonts.h: Add functions
to convert font descriptions to and from human-readable
strings.
* examples/viewer.c: Use functions from libpango instead
of rolling our own font-description conversion functions.
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | ChangeLog.pre-1-0 | 17 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 17 | ||||
-rw-r--r-- | ChangeLog.pre-1-2 | 17 | ||||
-rw-r--r-- | ChangeLog.pre-1-4 | 17 | ||||
-rw-r--r-- | ChangeLog.pre-1-6 | 17 | ||||
-rw-r--r-- | ChangeLog.pre-1-8 | 17 | ||||
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | examples/viewer.c | 154 | ||||
-rw-r--r-- | pango/fonts.c | 253 | ||||
-rw-r--r-- | pango/pango-font.h | 16 | ||||
-rw-r--r-- | pango/pangox.c | 3 |
12 files changed, 386 insertions, 165 deletions
@@ -1,12 +1,21 @@ +Mon Feb 28 19:46:35 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/fonts.c libpango/pango-fonts.h: Add functions + to convert font descriptions to and from human-readable + strings. + + * examples/viewer.c: Use functions from libpango instead + of rolling our own font-description conversion functions. + Fri Feb 25 15:04:21 2000 Owen Taylor <otaylor@redhat.com> * libpango/{fonts.c,pango-font.h,pango-context.[ch],pangox.c, - pango-attributes.c,examples/viewer.c: Add size to the - font description structure instead of continually passing - it around as an extra argument. + pango-attributes.c,examples/viewer.c: Add size to the + font description structure instead of continually passing + it around as an extra argument. * libpango/pangox.c: Take screen resolution into account when - choosing fonts, instead of assumming point == pixel. + choosing fonts, instead of assumming point == pixel. Fri Feb 25 12:32:01 2000 Owen Taylor <otaylor@redhat.com> diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0 index a0254f17..9d4e28a2 100644 --- a/ChangeLog.pre-1-0 +++ b/ChangeLog.pre-1-0 @@ -1,12 +1,21 @@ +Mon Feb 28 19:46:35 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/fonts.c libpango/pango-fonts.h: Add functions + to convert font descriptions to and from human-readable + strings. + + * examples/viewer.c: Use functions from libpango instead + of rolling our own font-description conversion functions. + Fri Feb 25 15:04:21 2000 Owen Taylor <otaylor@redhat.com> * libpango/{fonts.c,pango-font.h,pango-context.[ch],pangox.c, - pango-attributes.c,examples/viewer.c: Add size to the - font description structure instead of continually passing - it around as an extra argument. + pango-attributes.c,examples/viewer.c: Add size to the + font description structure instead of continually passing + it around as an extra argument. * libpango/pangox.c: Take screen resolution into account when - choosing fonts, instead of assumming point == pixel. + choosing fonts, instead of assumming point == pixel. Fri Feb 25 12:32:01 2000 Owen Taylor <otaylor@redhat.com> diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index a0254f17..9d4e28a2 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,12 +1,21 @@ +Mon Feb 28 19:46:35 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/fonts.c libpango/pango-fonts.h: Add functions + to convert font descriptions to and from human-readable + strings. + + * examples/viewer.c: Use functions from libpango instead + of rolling our own font-description conversion functions. + Fri Feb 25 15:04:21 2000 Owen Taylor <otaylor@redhat.com> * libpango/{fonts.c,pango-font.h,pango-context.[ch],pangox.c, - pango-attributes.c,examples/viewer.c: Add size to the - font description structure instead of continually passing - it around as an extra argument. + pango-attributes.c,examples/viewer.c: Add size to the + font description structure instead of continually passing + it around as an extra argument. * libpango/pangox.c: Take screen resolution into account when - choosing fonts, instead of assumming point == pixel. + choosing fonts, instead of assumming point == pixel. Fri Feb 25 12:32:01 2000 Owen Taylor <otaylor@redhat.com> diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index a0254f17..9d4e28a2 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,12 +1,21 @@ +Mon Feb 28 19:46:35 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/fonts.c libpango/pango-fonts.h: Add functions + to convert font descriptions to and from human-readable + strings. + + * examples/viewer.c: Use functions from libpango instead + of rolling our own font-description conversion functions. + Fri Feb 25 15:04:21 2000 Owen Taylor <otaylor@redhat.com> * libpango/{fonts.c,pango-font.h,pango-context.[ch],pangox.c, - pango-attributes.c,examples/viewer.c: Add size to the - font description structure instead of continually passing - it around as an extra argument. + pango-attributes.c,examples/viewer.c: Add size to the + font description structure instead of continually passing + it around as an extra argument. * libpango/pangox.c: Take screen resolution into account when - choosing fonts, instead of assumming point == pixel. + choosing fonts, instead of assumming point == pixel. Fri Feb 25 12:32:01 2000 Owen Taylor <otaylor@redhat.com> diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index a0254f17..9d4e28a2 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,12 +1,21 @@ +Mon Feb 28 19:46:35 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/fonts.c libpango/pango-fonts.h: Add functions + to convert font descriptions to and from human-readable + strings. + + * examples/viewer.c: Use functions from libpango instead + of rolling our own font-description conversion functions. + Fri Feb 25 15:04:21 2000 Owen Taylor <otaylor@redhat.com> * libpango/{fonts.c,pango-font.h,pango-context.[ch],pangox.c, - pango-attributes.c,examples/viewer.c: Add size to the - font description structure instead of continually passing - it around as an extra argument. + pango-attributes.c,examples/viewer.c: Add size to the + font description structure instead of continually passing + it around as an extra argument. * libpango/pangox.c: Take screen resolution into account when - choosing fonts, instead of assumming point == pixel. + choosing fonts, instead of assumming point == pixel. Fri Feb 25 12:32:01 2000 Owen Taylor <otaylor@redhat.com> diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index a0254f17..9d4e28a2 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,12 +1,21 @@ +Mon Feb 28 19:46:35 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/fonts.c libpango/pango-fonts.h: Add functions + to convert font descriptions to and from human-readable + strings. + + * examples/viewer.c: Use functions from libpango instead + of rolling our own font-description conversion functions. + Fri Feb 25 15:04:21 2000 Owen Taylor <otaylor@redhat.com> * libpango/{fonts.c,pango-font.h,pango-context.[ch],pangox.c, - pango-attributes.c,examples/viewer.c: Add size to the - font description structure instead of continually passing - it around as an extra argument. + pango-attributes.c,examples/viewer.c: Add size to the + font description structure instead of continually passing + it around as an extra argument. * libpango/pangox.c: Take screen resolution into account when - choosing fonts, instead of assumming point == pixel. + choosing fonts, instead of assumming point == pixel. Fri Feb 25 12:32:01 2000 Owen Taylor <otaylor@redhat.com> diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index a0254f17..9d4e28a2 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,12 +1,21 @@ +Mon Feb 28 19:46:35 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/fonts.c libpango/pango-fonts.h: Add functions + to convert font descriptions to and from human-readable + strings. + + * examples/viewer.c: Use functions from libpango instead + of rolling our own font-description conversion functions. + Fri Feb 25 15:04:21 2000 Owen Taylor <otaylor@redhat.com> * libpango/{fonts.c,pango-font.h,pango-context.[ch],pangox.c, - pango-attributes.c,examples/viewer.c: Add size to the - font description structure instead of continually passing - it around as an extra argument. + pango-attributes.c,examples/viewer.c: Add size to the + font description structure instead of continually passing + it around as an extra argument. * libpango/pangox.c: Take screen resolution into account when - choosing fonts, instead of assumming point == pixel. + choosing fonts, instead of assumming point == pixel. Fri Feb 25 12:32:01 2000 Owen Taylor <otaylor@redhat.com> @@ -25,6 +25,12 @@ X rendering (This doesn't really handle the case of optically scaled bitmaps properly, but I think that is an ignorable problem.) +* Right now we assume a single resolution for all fonts on a display; + but in theory, the resolution could be per-screen. To solve + this, we would probably want to add a window argument to + pango_x_get_context() and then have some sort of X specific font + loading interface. + Other rendering engines ====================== diff --git a/examples/viewer.c b/examples/viewer.c index 5d0877b2..9c280d65 100644 --- a/examples/viewer.c +++ b/examples/viewer.c @@ -72,7 +72,6 @@ GtkWidget *layout; PangoContext *context; static void fill_styles_combo (GtkWidget *combo); -static void font_description_from_string (PangoFontDescription *desc, const char *name); /* Read an entire file into a string */ @@ -850,8 +849,16 @@ void set_style (GtkWidget *entry, gpointer data) { char *str = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); + PangoFontDescription *tmp_desc; - font_description_from_string (&font_description, str); + tmp_desc = pango_font_description_from_string (str); + + font_description.style = tmp_desc->style; + font_description.variant = tmp_desc->variant; + font_description.weight = tmp_desc->weight; + font_description.stretch = tmp_desc->stretch; + + pango_font_description_free (tmp_desc); g_free (str); reload_font (); @@ -864,127 +871,6 @@ font_size_changed (GtkAdjustment *adj) reload_font(); } -typedef struct -{ - int value; - const char *str; -} FieldMap; - -FieldMap style_map[] = { - { PANGO_STYLE_NORMAL, NULL }, - { PANGO_STYLE_OBLIQUE, "Oblique" }, - { PANGO_STYLE_ITALIC, "Italic" } -}; - -FieldMap variant_map[] = { - { PANGO_VARIANT_NORMAL, NULL }, - { PANGO_VARIANT_SMALL_CAPS, "Small-Caps" } -}; - -FieldMap weight_map[] = { - { 300, "Light" }, - { PANGO_WEIGHT_NORMAL, NULL }, - { 500, "Medium" }, - { 600, "Semi-Bold" }, - { PANGO_WEIGHT_BOLD, "Bold" } -}; - -FieldMap stretch_map[] = { - { PANGO_STRETCH_ULTRA_CONDENSED, "Ultra-Condensed" }, - { PANGO_STRETCH_EXTRA_CONDENSED, "Extra-Condensed" }, - { PANGO_STRETCH_CONDENSED, "Condensed" }, - { PANGO_STRETCH_SEMI_CONDENSED, "Semi-Condensed" }, - { PANGO_STRETCH_NORMAL, NULL }, - { PANGO_STRETCH_SEMI_EXPANDED, "Semi-Expanded" }, - { PANGO_STRETCH_EXPANDED, "Expanded" }, - { PANGO_STRETCH_EXTRA_EXPANDED, "Extra-Expanded" }, - { PANGO_STRETCH_ULTRA_EXPANDED, "Ultra-Expanded" } -}; - -static void -append_field (GString *str, FieldMap *map, int n_elements, int val) -{ - int i; - for (i=0; i<n_elements; i++) - { - if (map[i].value == val) - { - if (map[i].str) - { - if (str->len != 0) - g_string_append_c (str, ' '); - g_string_append (str, map[i].str); - } - return; - } - } - - if (str->len != 0) - g_string_append_c (str, ' '); - g_string_sprintfa (str, "%d", val); -} - -static char * -font_description_to_string (PangoFontDescription *desc) -{ - GString *result = g_string_new (NULL); - gchar *str; - - append_field (result, style_map, G_N_ELEMENTS (style_map), desc->style); - append_field (result, variant_map, G_N_ELEMENTS (variant_map), desc->variant); - append_field (result, weight_map, G_N_ELEMENTS (weight_map), desc->weight); - append_field (result, stretch_map, G_N_ELEMENTS (stretch_map), desc->stretch); - - if (result->len == 0) - g_string_append (result, "Normal"); - - str = result->str; - g_string_free (result, FALSE); - return str; -} - -static gboolean -find_field (FieldMap *map, int n_elements, gchar *str, int *val) -{ - int i; - - for (i=0; i<n_elements; i++) - { - if (map[i].str && strcasecmp (map[i].str, str) == 0) - { - *val = map[i].value; - return TRUE; - } - } - - return FALSE; -} - -static void -font_description_from_string (PangoFontDescription *desc, const char *name) -{ - gchar **words; - int i; - - desc->style = PANGO_STYLE_NORMAL; - desc->variant = PANGO_VARIANT_NORMAL; - desc->weight = PANGO_WEIGHT_NORMAL; - desc->stretch = PANGO_STRETCH_NORMAL; - - words = g_strsplit (name, " ", -1); - for (i=0; words[i]; i++) - { - if (!(strcasecmp (words[i], "Normal") == 0 || - find_field (style_map, G_N_ELEMENTS (style_map), words[i], (int *)&desc->style) || - find_field (variant_map, G_N_ELEMENTS (variant_map), words[i], (int *)&desc->variant) || - find_field (weight_map, G_N_ELEMENTS (weight_map), words[i], (int *)&desc->weight) || - find_field (stretch_map, G_N_ELEMENTS (stretch_map), words[i], (int *)&desc->stretch))) - g_warning ("Unknown style modifier '%s'\n", words[i]); - } - - g_strfreev (words); -} - static int compare_font_descriptions (const PangoFontDescription *a, const PangoFontDescription *b) { @@ -992,18 +878,18 @@ compare_font_descriptions (const PangoFontDescription *a, const PangoFontDescrip if (val != 0) return val; - if (a->style != b->style) - return a->style - b->style; - - if (a->variant != b->variant) - return a->variant - b->variant; - if (a->weight != b->weight) return a->weight - b->weight; + if (a->style != b->style) + return a->style - b->style; + if (a->stretch != b->stretch) return a->stretch - b->stretch; + if (a->variant != b->variant) + return a->variant - b->variant; + return 0; } @@ -1039,7 +925,15 @@ fill_styles_combo (GtkWidget *combo) for (i=0; i<info->n_descs; i++) { - char *str = font_description_to_string (info->descs[i]); + char *str; + + PangoFontDescription tmp_desc; + + tmp_desc = *info->descs[i]; + tmp_desc.family_name = NULL; + tmp_desc.size = 0; + + str = pango_font_description_to_string (&tmp_desc); style_list = g_list_prepend (style_list, str); } diff --git a/pango/fonts.c b/pango/fonts.c index 45f1dcac..c6e4cbd8 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -19,6 +19,9 @@ * Boston, MA 02111-1307, USA. */ +#include <stdlib.h> +#include <ctype.h> + #include "pango.h" /** @@ -108,6 +111,256 @@ pango_font_descriptions_free (PangoFontDescription **descs, } } +typedef struct +{ + int value; + const char *str; +} FieldMap; + +FieldMap style_map[] = { + { PANGO_STYLE_NORMAL, NULL }, + { PANGO_STYLE_OBLIQUE, "Oblique" }, + { PANGO_STYLE_ITALIC, "Italic" } +}; + +FieldMap variant_map[] = { + { PANGO_VARIANT_NORMAL, NULL }, + { PANGO_VARIANT_SMALL_CAPS, "Small-Caps" } +}; + +FieldMap weight_map[] = { + { 300, "Light" }, + { PANGO_WEIGHT_NORMAL, NULL }, + { 500, "Medium" }, + { 600, "Semi-Bold" }, + { PANGO_WEIGHT_BOLD, "Bold" } +}; + +FieldMap stretch_map[] = { + { PANGO_STRETCH_ULTRA_CONDENSED, "Ultra-Condensed" }, + { PANGO_STRETCH_EXTRA_CONDENSED, "Extra-Condensed" }, + { PANGO_STRETCH_CONDENSED, "Condensed" }, + { PANGO_STRETCH_SEMI_CONDENSED, "Semi-Condensed" }, + { PANGO_STRETCH_NORMAL, NULL }, + { PANGO_STRETCH_SEMI_EXPANDED, "Semi-Expanded" }, + { PANGO_STRETCH_EXPANDED, "Expanded" }, + { PANGO_STRETCH_EXTRA_EXPANDED, "Extra-Expanded" }, + { PANGO_STRETCH_ULTRA_EXPANDED, "Ultra-Expanded" } +}; + +static gboolean +find_field (FieldMap *map, int n_elements, const char *str, int len, int *val) +{ + int i; + + for (i=0; i<n_elements; i++) + { + if (map[i].str && g_strncasecmp (map[i].str, str, len) == 0) + { + if (val) + *val = map[i].value; + return TRUE; + } + } + + return FALSE; +} + +static gboolean +find_field_any (const char *str, int len, PangoFontDescription *desc) +{ + return (g_strcasecmp (str, "Normal") == 0 || + find_field (style_map, G_N_ELEMENTS (style_map), str, len, + desc ? (int *)&desc->style : NULL) || + find_field (variant_map, G_N_ELEMENTS (variant_map), str, len, + desc ? (int *)&desc->variant : NULL) || + find_field (weight_map, G_N_ELEMENTS (weight_map), str, len, + desc ? (int *)&desc->weight : NULL) || + find_field (stretch_map, G_N_ELEMENTS (stretch_map), str, len, + desc ? (int *)&desc->stretch : NULL)); +} + +static const char * +getword (const char *str, const char *last, size_t *wordlen) +{ + const char *result; + + while (last > str && isspace (*(last - 1))) + last--; + + result = last; + while (result > str && !isspace (*(result - 1))) + result--; + + *wordlen = last - result; + + return result; +} + +/** + * pango_font_description_from_string: + * @str: string reprentation of a font description. + * + * Create a new font description from a string representation in the + * form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a + * comma separated list of families optionally terminated by a comma, + * STYLE_OPTIONS is a whitespace separated list of words where each + * WORD describes one of style, variant, weight, or stretch, and SIZE + * is an decimal number (size in points). Any one of the options may + * be absent. If FAMILY-LIST is absent, then the family_name field of + * the resulting font description will be initialized to NULL. If + * STYLE-OPTIONS is missing, then all style options will be set to the + * default values. If SIZE is missing, the size in the resulting font + * description will be set to 0. + * + * Return value: a new #PangoFontDescription, or %NULL if the + * string could not be parsed. + **/ +PangoFontDescription * +pango_font_description_from_string (const char *str) +{ + PangoFontDescription *desc; + const char *p, *last; + size_t len, wordlen; + + g_return_val_if_fail (str != NULL, NULL); + + desc = g_new (PangoFontDescription, 1); + + desc->family_name = NULL; + desc->style = PANGO_STYLE_NORMAL; + desc->weight = PANGO_WEIGHT_NORMAL; + desc->variant = PANGO_VARIANT_NORMAL; + desc->stretch = PANGO_STRETCH_NORMAL; + + desc->size = 0; + + len = strlen (str); + last = str + len; + p = getword (str, last, &wordlen); + + /* Look for a size at the end of the string + */ + if (wordlen != 0) + { + char *end; + double size = strtod (p, &end); + if (end - p == wordlen) /* word is a valid float */ + { + desc->size = (int)(size * 1000 + 0.5); + last = p; + } + } + + /* Now parse style words + */ + p = getword (str, last, &wordlen); + while (wordlen != 0) + { + if (!find_field_any (p, wordlen, desc)) + break; + else + { + last = p; + p = getword (str, last, &wordlen); + } + } + + /* Remainder (str => p) is family list. Trim off trailing commas and leading and trailing white space + */ + + while (last > str && isspace (*(last - 1))) + last--; + + if (last > str && *(last - 1) == ',') + last--; + + while (last > str && isspace (*(last - 1))) + last--; + + while (isspace (*str)) + str++; + + if (str != last) + desc->family_name = g_strndup (str, last - str); + + return desc; +} + +static void +append_field (GString *str, FieldMap *map, int n_elements, int val) +{ + int i; + for (i=0; i<n_elements; i++) + { + if (map[i].value == val) + { + if (map[i].str) + { + if (str->len != 0) + g_string_append_c (str, ' '); + g_string_append (str, map[i].str); + } + return; + } + } + + if (str->len != 0) + g_string_append_c (str, ' '); + g_string_sprintfa (str, "%d", val); +} + +/** + * pango_font_description_to_string: + * @desc: a #PangoFontDescription + * + * Create a string representation of a font description. See + * pango_font_description_from_string() for a description of the + * format of the string representation. The family list in the + * string description will only have a terminating comma if the + * last word of the list is a valid style option. + * + * Return value: a new string that must be freed with g_free(). + **/ +char * +pango_font_description_to_string (const PangoFontDescription *desc) +{ + GString *result = g_string_new (NULL); + char *str; + + if (desc->family_name) + { + const char *p; + size_t wordlen; + + g_string_append (result, desc->family_name); + + p = getword (desc->family_name, desc->family_name + strlen(desc->family_name), &wordlen); + if (wordlen != 0 && find_field_any (p, wordlen, NULL)) + g_string_append_c (result, ','); + } + + append_field (result, weight_map, G_N_ELEMENTS (weight_map), desc->weight); + append_field (result, style_map, G_N_ELEMENTS (style_map), desc->style); + append_field (result, stretch_map, G_N_ELEMENTS (stretch_map), desc->stretch); + append_field (result, variant_map, G_N_ELEMENTS (variant_map), desc->variant); + + if (result->len == 0) + g_string_append (result, "Normal"); + + if (desc->size > 0) + { + if (result->len == 0) + g_string_append_c (result, ' '); + + g_string_sprintfa (result, "%f", desc->size / 1000.); + } + + str = result->str; + g_string_free (result, FALSE); + return str; +} + /** * pango_font_init: * @font: a #PangoFont diff --git a/pango/pango-font.h b/pango/pango-font.h index d6d67d0e..bae83660 100644 --- a/pango/pango-font.h +++ b/pango/pango-font.h @@ -74,12 +74,16 @@ struct _PangoFontDescription int size; }; -PangoFontDescription *pango_font_description_copy (const PangoFontDescription *desc); -gboolean pango_font_description_compare (const PangoFontDescription *desc1, - const PangoFontDescription *desc2); -void pango_font_description_free (PangoFontDescription *desc); -void pango_font_descriptions_free (PangoFontDescription **descs, - int n_descs); +PangoFontDescription *pango_font_description_copy (const PangoFontDescription *desc); +gboolean pango_font_description_compare (const PangoFontDescription *desc1, + const PangoFontDescription *desc2); +void pango_font_description_free (PangoFontDescription *desc); +void pango_font_descriptions_free (PangoFontDescription **descs, + int n_descs); + +PangoFontDescription *pango_font_description_from_string (const char *str); +char * pango_font_description_to_string (const PangoFontDescription *desc); + /* Logical fonts */ diff --git a/pango/pangox.c b/pango/pangox.c index 1adf0603..203ea5d2 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -1081,10 +1081,11 @@ pango_x_insert_font (PangoXFontMap *xfontmap, char *identifier; int i; + description.size = 0; + /* First insert the XLFD into the list of XLFDs for the "identifier" - which * is the 2-4th fields of the XLFD */ - identifier = pango_x_get_identifier (fontname); size_info = g_hash_table_lookup (xfontmap->size_infos, identifier); if (!size_info) |