[Fontconfig] fontconfig match question

Simos Xenitellis simos.lists at googlemail.com
Sun Jul 16 06:14:21 PDT 2006


Στις 16-07-2006, ημέρα Κυρ, και ώρα 08:29 -0400, ο/η Stephen C. North
έγραψε:
> Greetings.  We use fontconfig in Graphviz.  Before we did this,
> we had some simple rules to bind fonts by names to system font
> files.  Obviously fontconfig improves this greatly, but we also
> want to report to a human when the match has, for all practical
> purposes, failed.  For example, the user may specify a font
> that does not exist locally, or we may have misconfigured fontconfig
> or made an error in Graphviz itself.  
> 
> fontconfig silently fails over to some default.  How can we tell
> when this happens and warn the user?

I suppose the plan would be to iterate through the list of all installed
fonts to check if the selected font is indeed installed. 
If it is not installed, notify the user that the default "Sans" alias
will be used.

> Very recently I noticed that the 'default' font in Graphviz was
> a sans-serif font, not Times (which it has been for years).
> This turned out to be a logic error on our part, but we strongly
> feel that if the user asks for XYZ font and basically there is
> no such thing locally, we ought to be able to provide a warning.
> 
> How can we do this?

Normally, the suggested way is to delegate the choice of the suitable
desktop font to the Linux distribution; applications will use this
default font so the look and feel will be similar across the desktop.

Using the default "virtual" font Sans that the distribution defines, it
is possible to show text correctly in different languages (provided
fonts.conf has been configured well to pick up the proper fonts by the
distro).

Of course, if the user prefers a specific font, then the glyphs from
this font will take precedence over the others installed on the system.
I think that you can consider that when you specify the font, you
effectively get the Sans font where your selected font goes on the top
of the preference list.

Hope this helps,
Simos




More information about the Fontconfig mailing list