[Fontconfig] how to use multiple fonts?

Keith Packard fontconfig@fontconfig.org
Tue, 04 Mar 2003 09:19:57 -0800


Around 18 o'clock on Mar 4, Federic Zhang wrote:

> seems that it just picks ONLY one font and try to use it to render the
> string no matter that the font can't cover all characters.

The API you were using uses a single font; there isn't (yet?) an API 
within Xft to switch among multiple fonts.  I expected applications to
want to group glyphs in the same font, but so far that hasn't happened.  I 
may figure out a reasonable interface now.

For multiple font use (which all applications should use), you use
FcFontSort to compute the list of fonts needed to display as much Unicode
as you've got fonts for.  The list includes Unicode coverage for each font, 
so you can just walk the list looking for the first font supporting each
character.

There's a bit more to it; you'll find examples in Mozilla, Qt and Pango at 
this point.  I'd like help defining an appropriate Xft API for this 
operation; it may be as simple as extending an XftFont to support 
additional fonts or perhaps it should just use new APIs.  I don't know 
what's best.

Keith Packard        Cambridge Research Lab	Hewlett Packard