I hear that fontconfig is the best option for getting fonts in linux. Unfortunately, I\'ve been looking through their developer documentation and I have absolutely no clue what
This is not exactly what you are asking for, but it will give you the list of fonts available.
#include
FcPattern *pat;
FcFontSet *fs;
FcObjectSet *os;
FcChar8 *s, *file;
FcConfig *config;
FcBool result;
int i;
result = FcInit();
config = FcConfigGetCurrent();
FcConfigSetRescanInterval(config, 0);
// show the fonts (debugging)
pat = FcPatternCreate();
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_LANG, (char *) 0);
fs = FcFontList(config, pat, os);
printf("Total fonts: %d", fs->nfont);
for (i=0; fs && i < fs->nfont; i++) {
FcPattern *font = fs->fonts[i];//FcFontSetFont(fs, i);
FcPatternPrint(font);
s = FcNameUnparse(font);
if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch) {
printf("Filename: %s", file);
}
printf("Font: %s", s);
free(s);
}
if (fs) FcFontSetDestroy(fs);