[Fontconfig] A question about font styles
otaylor at redhat.com
Tue Mar 8 08:02:05 EST 2005
On Mon, 2005-03-07 at 12:40 -0800, Keith Packard wrote:
> Around 14 o'clock on Mar 7, Owen Taylor wrote:
> > Would you count it as expected that:
> > desc = pango_font_face_describe (face);
> > pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
> > /* Use desc */
> > Ignores the call to set_weight? (because describe() sets some
> > "face name" field)
> (did you mean "style name"?)
"face name" would be more likely as a Pango name, since Pango also
follows CSS in using "style" for Normal/Oblique/Italic.
> Hmm. Sequence doesn't exist in fontconfig. I think that might make a
> difference for the user...
Well, the sequence doesn't really exist in fontconfig because fontconfig
doesn't expose any family or face objects, or even, really, the *notion*
of family or face, other than as accidental coincidences of strings
for listed fonts. There is nothing in the fontconfig API that would
prevent it from listing two fonts with the same family and style but
different CSS properties.
I've tried to keep things much more structured and constrained for
Pango, and thus hopefully simpler for the programmer.
> If you think of the style name as restricting the available variants to the
> selected style, or selecting a sub-family with the 'postscript name', then
> the 'set_weight' call is no more ignored than if face was already black;
> it's requesting the 'bold' variant of 'Cloister Old Style Roman' which
> doesn't happen to have a bold variant
The logic follows, yes. I'd rather not have to explain it to my users
that way :-)
> Consider the fonts I just got -- named Cloister Old Style Roman, Cloister
> Old Style Italic, Cloister Old Style Bold and Cloister Old Style Bold
> Italic. All of these advertised a single style named 'Roman' (the humor
> of a 'Roman' 'Italic' font clearly escaped the publisher).
> If the 'description' returned is used by the application to present
> information to the user and to select fonts, then we have a problem as it
> should contain the style name so the user can read it, but it shouldn't
> have the style name as a constraint on the selection. Perhaps those two
> notions could be separated somehow?
The API is already there for Pango:
This is the API that is used by the font selector and currently returns the fontconfig
'style'. (needs extension to handle localized names ... get_face_name_for_language() likely)
More information about the Fontconfig