[Fontconfig] Finding a font but without fallback

Keith Packard keithp at keithp.com
Sat Apr 26 11:58:34 PDT 2008


On Fri, 2008-04-25 at 15:29 -0700, Sairus Patel wrote:
> > I'd be *very* suspicious of any application 
> that tried to disable the normal system font management
> 
> [ I'm assuming that by "the normal system font 
> management" you mean FontConfig's fallback mechanism. ]
> 
> I believe I have good reasons to do so. I want my 
> app to have its own fallback mechanism. This 
> fallback mechanism will not just replace one font 
> with another, as FontConfig seems to be doing, 
> but do the fallback on a grapheme cluster 
> granularity. (My app does its own layout, parsing 
> GSUB and GPOS and other OT tables.) For this, I 
> need to be able to tell whether a particular font 
> is present on the system or not.

Fontconfig doesn't do any of the font substitution, it simply provides
information about the available fonts. It certainly isn't responsible
for doing glyph-by-glyph substitution; that obviously couldn't work.

Pango, for instance, does precisely what you're looking to do as it
builds sets of glyphs based on the input unicode stream and the set of
fonts returned by fontconfig.

> 
>  > I'd say look up gucharmap's code
> 
> gucharmap doesn't seem to use FontConfig (I 
> grepped for "Fc" and got no matches), but maybe 
> it uses another facility e.g. Pango, which relies 
> on FC. So it doesn't really answer my question 
> about whether I can get FontConfig to tell me 
> whether a particular font is present on the system or not.

The FcList functions can tell you whether a specific font is available,
or you can use the FcMatch functions and simply check the returned font
family.

Fontconfig is supposed to provide a central database of available fonts
with some simple search operations to look for suitable font sets for
your application. If the search operations provided can't do what you
want, we should add some that do. 

Working around the library doesn't make sense -- your application
performance will suffer badly if you end up constructing your own font
database as fontconfig is both reasonably efficient and also generally
integrated into the package management system from your operating system
to ensure reliable and fast font package management.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20080426/503769b4/attachment.pgp 


More information about the Fontconfig mailing list