Ensure the user config dir is available in the list of config dirs on the fallback config

This commit is contained in:
Akira TAGOH 2018-02-05 13:31:00 +09:00
parent 34b5c949d5
commit 0394cb7829
1 changed files with 11 additions and 3 deletions

View File

@ -39,15 +39,23 @@ static FcConfig *
FcInitFallbackConfig (const FcChar8 *sysroot) FcInitFallbackConfig (const FcChar8 *sysroot)
{ {
FcConfig *config; FcConfig *config;
const FcChar8 *fallback = (const FcChar8 *) "" \
"<fontconfig>" \
" <dir>" FC_DEFAULT_FONTS "</dir>" \
" <dir prefix=\"xdg\">fonts</dir>" \
" <cachedir>" FC_CACHEDIR "</cachedir>" \
" <cachedir prefix=\"xdg\">fontconfig</cachedir>" \
" <include ignore_missing=\"yes\" prefix=\"xdg\">fontconfig/conf.d</include>" \
" <include ignore_missing=\"yes\" prefix=\"xdg\">fontconfig/fonts.conf</include>" \
"</fontconfig>";
config = FcConfigCreate (); config = FcConfigCreate ();
if (!config) if (!config)
goto bail0; goto bail0;
FcConfigSetSysRoot (config, sysroot); FcConfigSetSysRoot (config, sysroot);
if (!FcConfigAddFontDir (config, (FcChar8 *) FC_DEFAULT_FONTS)) if (!FcConfigParseAndLoadFromMemory (config, fallback, FcFalse))
goto bail1;
if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR))
goto bail1; goto bail1;
return config; return config;
bail1: bail1: