[Fontconfig] font pattern -> font file : without X11 dependencies?

Keith Packard fontconfig@fontconfig.org
Sun, 16 Mar 2003 12:56:23 -0800

Around 13 o'clock on Mar 16, John Ellson wrote:

> Is there any example code for converting a font-pattern to a font 
> filename *without* any X11 dependencies?

I don't know of any examples, but certainly Xft itself has code which does 
that that you can rip out of the library and use.   The basic routine is 
something like:

    if (!FcInit (0))
        return 0;

    FcConfigSubstitute (0, pattern, FcMatchPattern);
    FcDefaultSubstitute (pattern)
    match = FcFontMatch (0, pattern, result);
    return match;

'match' now contains all of the information needed to access the font file.

If you want to find a list of fonts, you use FcFontSort instead; that's 
useful if you need to do glyph fill-in to handle glyphs not present in the 
best matching font.