diff --git a/src/fccfg.c b/src/fccfg.c index 5467493..cc2d9ee 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -1843,6 +1843,7 @@ FcConfigSubstitute (FcConfig *config, #if defined (_WIN32) static FcChar8 fontconfig_path[1000] = ""; /* MT-dontcare */ +FcChar8 fontconfig_instprefix[1000] = ""; /* MT-dontcare */ # if (defined (PIC) || defined (DLL_EXPORT)) @@ -1877,6 +1878,7 @@ DllMain (HINSTANCE hinstDLL, if (p && (FcStrCmpIgnoreCase (p + 1, (const FcChar8 *) "bin") == 0 || FcStrCmpIgnoreCase (p + 1, (const FcChar8 *) "lib") == 0)) *p = '\0'; + strcat ((char *) fontconfig_instprefix, (char *) fontconfig_path); strcat ((char *) fontconfig_path, "\\etc\\fonts"); } else diff --git a/src/fcxml.c b/src/fcxml.c index 331a444..9a6f08d 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -54,6 +54,7 @@ #ifdef _WIN32 #include +extern FcChar8 fontconfig_instprefix[]; #endif static void @@ -2187,7 +2188,25 @@ FcParseCacheDir (FcConfigParse *parse) data = prefix; } #ifdef _WIN32 - if (strcmp ((const char *) data, "WINDOWSTEMPDIR_FONTCONFIG_CACHE") == 0) + else if (data[0] == '/' && fontconfig_instprefix[0] != '\0') + { + size_t plen = strlen ((const char *)fontconfig_instprefix); + size_t dlen = strlen ((const char *)data); + + prefix = malloc (plen + 1 + dlen + 1); + if (!prefix) + { + FcConfigMessage (parse, FcSevereError, "out of memory"); + goto bail; + } + strcpy ((char *) prefix, (char *) fontconfig_instprefix); + prefix[plen] = FC_DIR_SEPARATOR; + memcpy (&prefix[plen + 1], data, dlen); + prefix[plen + 1 + dlen] = 0; + FcStrFree (data); + data = prefix; + } + else if (strcmp ((const char *) data, "WINDOWSTEMPDIR_FONTCONFIG_CACHE") == 0) { int rc; FcStrFree (data);