From c95f125f3296d75789685fe1ababe48abe161973 Mon Sep 17 00:00:00 2001 From: Comment Date: Wed, 13 Nov 2013 21:54:42 +0000 Subject: looking at fontconfig --- working/test_fontconfig.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 working/test_fontconfig.cpp (limited to 'working/test_fontconfig.cpp') diff --git a/working/test_fontconfig.cpp b/working/test_fontconfig.cpp new file mode 100644 index 0000000..a6a6411 --- /dev/null +++ b/working/test_fontconfig.cpp @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +int main() { + FcBool success = FcInit (); + if ( !success ) { + return false; + } + + FcConfig *config = FcInitLoadConfigAndFonts (); + if(!config) { + return false; + } + + FcChar8 *s, *file; + + FcPattern *p = FcPatternCreate(); + FcObjectSet *os = FcObjectSetBuild (FC_FAMILY,NULL); + FcFontSet *fs = FcFontList(config, p, os); + + printf("Total fonts: %d\n", fs->nfont); + for (int i=0; fs && i < fs->nfont; i++) { + FcPattern *font = fs->fonts[i]; + + s = FcNameUnparse(font); + printf("Font: %s\n", s); + free(s); + + if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch) { + printf("Filename: %s\n", file); + } + } +} \ No newline at end of file -- cgit v1.2.3