After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 168085 - numeric styles in pango_font_description_to_string()
numeric styles in pango_font_description_to_string()
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: Small API
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2005-02-21 20:54 UTC by Owen Taylor
Modified: 2009-01-04 02:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add some sort of syntax extension to the PangoFontDescription strings (1.32 KB, patch)
2006-03-09 07:31 UTC, LingNing Zhang
none Details | Review
add add some sort of syntax extension and modify pango_font_description_to_filename( ) (2.86 KB, patch)
2006-03-09 09:36 UTC, LingNing Zhang
rejected Details | Review

Description Owen Taylor 2005-02-21 20:54:49 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".
Comment 1 LingNing Zhang 2006-03-09 07:31:58 UTC
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.
Comment 2 LingNing Zhang 2006-03-09 09:36:04 UTC
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.
Comment 3 Behdad Esfahbod 2009-01-04 02:13:24 UTC
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.