Travis Griggs
2005-Nov-21 08:51 UTC
[Fontconfig] How to list fonts? (or, what is an _FcPattern)
On Nov 2, 2005, at 15:17, Patrick Lam wrote:> 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.cAha! Thank you. I saw the accessors, but skipped right over them, I was so intent on just setting up a mirror structure definition in my language binding. Thank you again. -- Travis Griggs Objologist "Only one thing is impossible for God: to find any sense in any copyright law on the planet." -- Mark Twain ----------------------------------------- DISCLAIMER: This email is bound by the terms and conditions described at http://www.key.net/disclaimer.htm
Patrick Lam
2005-Nov-21 08:51 UTC
[Fontconfig] How to list fonts? (or, what is an _FcPattern)
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
Travis Griggs
2005-Nov-21 08:51 UTC
[Fontconfig] How to list fonts? (or, what is an _FcPattern)
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. -- Travis Griggs Objologist "It had better be a pretty good meeting, to be better than no meeting at all" -- Boyd K Packer ----------------------------------------- DISCLAIMER: This email is bound by the terms and conditions described at http://www.key.net/disclaimer.htm
Travis Griggs
2005-Nov-21 08:51 UTC
[Fontconfig] How to list fonts? (or, what is an _FcPattern)
On Nov 2, 2005, at 15:17, Patrick Lam wrote:> 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).Just out of curiosity, what''s the 3rd parameter for? The man page makes it sound like I simply give it a pointer, which it then points at the internal character array. I don''t actually need my own buffer, I''m assuming. And the fact that your example shows a 0 there would support that. So what''s it do? TIA -- Travis Griggs Objologist "Conference calls: the appearance of doing work without the substance thereof" -- Bruce Boyer ----------------------------------------- DISCLAIMER: This email is bound by the terms and conditions described at http://www.key.net/disclaimer.htm