diff --git a/rts/Rendering/Fonts/CFontTexture.cpp b/rts/Rendering/Fonts/CFontTexture.cpp index 753d1e0b41..7f872fcfcb 100644 --- a/rts/Rendering/Fonts/CFontTexture.cpp +++ b/rts/Rendering/Fonts/CFontTexture.cpp @@ -120,7 +120,8 @@ class FtLibraryHandler { return; } - config = FcConfigCreate(); + FcConfigEnableHome(FcFalse); + config = FcInitLoadConfigAndFonts(); if (!config) return; @@ -182,34 +183,24 @@ class FtLibraryHandler { return false; } - char osFontsDir[8192]; - - #ifdef _WIN32 - ExpandEnvironmentStrings("%WINDIR%\\fonts", osFontsDir, sizeof(osFontsDir)); // expands %HOME% etc. - #else - strncpy(osFontsDir, "/etc/fonts/", sizeof(osFontsDir)); - #endif - FcConfigAppFontClear(GetFCConfig()); FcConfigAppFontAddDir(GetFCConfig(), reinterpret_cast("fonts")); - FcConfigAppFontAddDir(GetFCConfig(), reinterpret_cast(osFontsDir)); { auto dirs = FcConfigGetCacheDirs(GetFCConfig()); FcStrListFirst(dirs); - for (FcChar8* dir = FcStrListNext(dirs), *prevDir = nullptr; dir != nullptr && dir != prevDir; ) { - prevDir = dir; + for (FcChar8* dir = FcStrListNext(dirs); dir != nullptr; dir = FcStrListNext(dirs)) { LOG_MSG("[%s] Using Fontconfig cache dir \"%s\"", false, __func__, dir); } FcStrListDone(dirs); } if (FtLibraryHandler::CheckFontConfig()) { - LOG_MSG("[%s] fontconfig for directory \"%s\" up to date", false, __func__, osFontsDir); + LOG_MSG("[%s] fontconfig up to date", false, __func__); return true; } - LOG_MSG("[%s] creating fontconfig for directory \"%s\"", false, __func__, osFontsDir); + LOG_MSG("[%s] creating fontconfig", false, __func__); return FcConfigBuildFonts(GetFCConfig()); #endif @@ -427,7 +418,6 @@ static std::shared_ptr GetFontForCharacters(const std::vector("not used"); @@ -448,7 +438,6 @@ static std::shared_ptr GetFontForCharacters(const std::vector GetFontForCharacters(const std::vector