GNOME Bugzilla – Bug 168085
numeric styles in pango_font_description_to_string()
Last modified: 2009-01-04 02:13:24 UTC
pango_font_description_to_string() uses numbers if the style can't be described with on of the standard constants. But something like Times 100 200 is nonsense... what of the four values are the two numbers? Or is it 1 number and a size? Fixing this requires some sort of syntax extension to the PangoFontDescription strings. Perhaps Times weight=100 slant=200 I think it's unlikely people have fonts with names like "Times weight=100".
Created attachment 60947 [details] [review] add some sort of syntax extension to the PangoFontDescription strings I wrote a patch for fixing this bug, and I addded some sort of syntax extension to the PangoFontDescription strings. The syntax extensions are for style, variant, weight and stretch. For example: pango_font_description_set_style(font_desc, PANGO_STYLE_ITALIC); pango_font_description_set_variant(font_desc, PANGO_VARIANT_SMALL_CAPS); pango_font_description_set_weight(font_desc, PANGO_WEIGHT_BOLD); pango_font_description_set_stretch(font_desc, PANGO_STRETCH_SEMI_CONDENSED); pango_font_description_set_size (font_desc, 80 * PANGO_SCALE); pango_font_description_set_family(font_desc, "Sans"); ch = pango_font_description_to_string(font_desc); And the information of printing ch is below: "ch = Sans weight=Bold style=Italic stretch=Semi-Condensed variant=Small-Caps 80 " I did not add the syntax extensions for size and family.
Created attachment 60955 [details] [review] add add some sort of syntax extension and modify pango_font_description_to_filename( ) I find that there is a bug when I call pango_font_description_to_filename( ) after writing the patch, so I modifed the patch. Now pango_font_description_to_filename( ) is OK.
2009-01-03 Behdad Esfahbod <behdad@gnome.org> Bug 168085 – numeric styles in pango_font_description_to_string() * pango/fonts.c (parse_int), (find_field), (find_field_any), (append_field), (pango_font_description_to_string): Print-out, and parse, numeric styles correctly. Things like "DejaVu Sans weight=100" parse correctly now.