[Fontconfig] How to list fonts? (or, what is an _FcPattern)

Patrick Lam plam at MIT.EDU
Wed Nov 2 15:17:44 PST 2005


Travis Griggs wrote:
> I'm trying to use XftListFonts() to list fonts. The problem is...  after
> digging through header files, I can't figure out how one goes  from the
> FcFontSet* returned by this thing to something you can  display in a
> dialog. Because I can't find the definition of an  _FcPattern. I'm
> running on debian testing, and I have the fontconfig- dev package
> loaded, so I don't know what gives.

The FcPattern contents are opaque.  However, what you probably want to
do is to iterate over the array in the FcFontSet and call e.g.
FcPatternGetString (p, FC_FAMILY, 0, &s); to get the family name of an
FcPattern (returned in s).

One way of going from an FcPattern to a string is FcNameUnparse,
although this is probably not the string you want.

You may want to consult fc-list/fc-list.c

pat



More information about the Fontconfig mailing list