GNOME Bugzilla – Bug 131561
condensed fonts can't be selected
Last modified: 2004-12-22 21:47:04 UTC
I have a number of 'condensed' fonts installed. I can see them with xlsfonts, and fc-list, and they worked fine in gimp1.2. I've upgraded to the debian unstable gimp1.3 package, and now I can't select them. The fonts seem to appear as duplicates in the font menu, but selecting either variant seems to give me the 'normal' font, and I cannot select the condensed one. For example... fc-list | grep 'Nimbus Sans L' Nimbus Sans L:style=Regular Italic Nimbus Sans L:style=Bold Nimbus Sans L:style=Regular Nimbus Sans L:style=Bold Condensed Nimbus Sans L:style=Bold Italic Nimbus Sans L:style=Regular Condensed Italic Nimbus Sans L:style=Regular Condensed Nimbus Sans L:style=Bold Condensed Italic ... but the choices I get in GIMP are ... Nimbus Sans L Nimbus Sans L Nimbus Sans L, Bold Nimbus Sans L, Bold Nimbus Sans L, Bold Italic Nimbus Sans L, Bold Italic Nimbus Sans L, Italic Nimbus Sans L, Italic Obviously, this is a bit of a limiting factor, and I'm going to have to go back to gimp1.2 to work around it :-(
We're not handling the stretch property here. This might be able to be worked around. FWIW, you can't really use these fonts in any gtk2 xft app.
2004-01-15 Manish Singh <yosh@gimp.org> * app/text/gimpfontlist.c: Set PangoStretch from FC_WIDTH. This partially addresses #131561 (namely, the gimp side).
Now pango needs to actually use the width property when querying fontconfig. I'll do up a patch for that. For the nimbus sans fonts specifically, you need a fontconfig 2.2.90 or higher, since the fonts themselves don't actually have any width information, and the style string isn't parsed for these settings until 2.2.90.
Created attachment 24632 [details] [review] Initial patch
So even with this patch, fontconfig doesn't seem to correctly select the condensed versions of the fonts the reporter was having trouble with. I *think* the problem lies in fontconfig, but I haven't had a chance to investigate further. I also did a bit of cleanup/reorg, and I cased this on #ifdef FC_WIDTH instead of a configure test.
I guess I'd like to see this debugged in fontconfig before the patch goes in, since without knowing what is going wrong I can't tell if the patch is harmless or will trigger active misbehavior. Detailed comments are: + case PANGO_STRETCH_NORMAL: + width = FC_WIDTH_NORMAL; + break; I'd rather just see as: return FC_WIDTH_NORMAL; saves a significant number of lines of space vertically. And I rather see convert_width() #ifdef'ed out entirely in the case of !FC_WIDTH. Seeing + return 0; in a function that is supposed to return an enumeration bothers me.
Pretty sure there's a fontconfig bug: http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=211
I've revised the patch, per owen's comments. I also made pango_fc_font_description_from_pattern use helper functions too.
Created attachment 24679 [details] [review] Revised patch
Ok, the bug is fixed in fontconfig cvs, it now simply defaults width to normal if the font doesn't explictly specify it. With the patch to pango here, one can use these fonts in gimp just fine. Is this ok to commit now?
Also, there is no difference in behavior with or without this patch with old fontconfigs, so there's no regressions.
Thu Mar 11 17:28:06 2004 Manish Singh <yosh@gimp.org> * pango/pangofc-fontmap.c: Convert PangoStretch to and from FC_WIDTH, so we can actually get fontconfig to match on condensed and expanded versions of fonts, and have the info survive a pango_fc_face_describe roundtrip. Fixes #131561. * pango/pangox-fontmap.c: Remove unused function free_coverages_foreach.
*** Bug 137194 has been marked as a duplicate of this bug. ***