Reputation: 21
I imitated the code in this link, except that I wanted to add support for local fonts, so the code was adapted like this.
FcConfig* config = FcInitLoadConfigAndFonts();
FcConfigAppFontAddDir(config, (FcChar8*) "../fonts");
FcConfigSubstitute(config, pat, FcMatchPattern);
FcDefaultSubstitute(pat);
FcStrList* dirs = FcConfigGetFontDirs(config);
FcChar8* current;
while ((current = FcStrListNext(dirs)) != NULL)
printf("%s\n", (char*) current);
FcResult res;
FcPattern* font = FcFontMatch(config, pat, &res);
if (font)
{
FcChar8* file = NULL;
if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch)
{
printf("%s\n", (char*) file);
}
FcPatternDestroy(font);
}
FcPatternDestroy(pat);
FcStrListDone(dirs);
However, I found the following situation:
.uuid
file appears in fonts
directory, meaning that the directory (along with font files in it) is correctly found.Update: The fonts can only be referenced through font name as opposed to file name. Case closed.
Upvotes: -1
Views: 96
Reputation: 21
Update: The fonts can only be referenced through font name as opposed to file name. Case closed.
Upvotes: 2