X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=src%2Ffcfreetype.c;h=2eae80a1cb66f79d97ad1118869cb3f894850252;hb=d0471dd2faca37f7ee5997ad9db8278db0e99206;hp=56ee380cd649c7894c99a175803df6e2e2b59778;hpb=bb8057ea77ec89e789afbc6e87b7a16d479d3105;p=fontconfig.git diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 56ee380..2eae80a 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1743,19 +1743,35 @@ bail0: } FcPattern * -FcFreeTypeQuery(const FcChar8 *file, - int id, - FcBlanks *blanks, - int *count) +FcFreeTypeQuery (const FcChar8 *file, + int id, + FcBlanks *blanks, + int *count) +{ + return FcFreeTypeQuery2 (FcConfigGetCurrent (), file, id, blanks, count); +} + +FcPattern * +FcFreeTypeQuery2 (FcConfig *config, + const FcChar8 *file, + int id, + FcBlanks *blanks, + int *count) { FT_Face face; FT_Library ftLibrary; FcPattern *pat = NULL; + const FcChar8 *ftFile = file; + FcChar8 *fullFile; if (FT_Init_FreeType (&ftLibrary)) return NULL; - if (FT_New_Face (ftLibrary, (char *) file, id, &face)) + fullFile = FcConfigGetRootPlus (config, file); + if (fullFile) + ftFile = fullFile; + + if (FT_New_Face (ftLibrary, (char *) ftFile, id, &face)) goto bail; *count = face->num_faces; @@ -1764,6 +1780,8 @@ FcFreeTypeQuery(const FcChar8 *file, FT_Done_Face (face); bail: + if (fullFile) + FcStrFree (fullFile); FT_Done_FreeType (ftLibrary); return pat; }