return FcConfigSubstituteWithPat (config, p, 0, kind);
}
-#if defined (_WIN32) && (defined (PIC) || defined (DLL_EXPORT))
+#if defined (_WIN32)
+
+# define WIN32_LEAN_AND_MEAN
+# define WIN32_EXTRA_LEAN
+# include <windows.h>
static FcChar8 fontconfig_path[1000] = "";
+# if (defined (PIC) || defined (DLL_EXPORT))
+
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
return TRUE;
}
+# endif /* !PIC */
+
#undef FONTCONFIG_PATH
#define FONTCONFIG_PATH fontconfig_path
-#else /* !(_WIN32 && PIC) */
-
-#endif /* !(_WIN32 && PIC) */
+#endif /* !_WIN32 */
#ifndef FONTCONFIG_FILE
#define FONTCONFIG_FILE "fonts.conf"
}
}
+#ifdef _WIN32
+ if (fontconfig_path[0] == '\0')
+ {
+ if(!GetModuleFileName(NULL, fontconfig_path, sizeof(fontconfig_path)))
+ goto bail1;
+ char *p = strrchr (fontconfig_path, '\\');
+ if (p) *p = '\0';
+ strcat (fontconfig_path, "\\fonts");
+ }
+#endif
dir = (FcChar8 *) FONTCONFIG_PATH;
path[i] = malloc (strlen ((char *) dir) + 1);
if (!path[i])
FcConfigFilename (const FcChar8 *url)
{
FcChar8 *file, *dir, **path, **p;
-
+
if (!url || !*url)
{
url = (FcChar8 *) getenv ("FONTCONFIG_FILE");
break;
}
#ifdef _WIN32
- if (strcmp (data, "WINDOWSFONTDIR") == 0)
+ if (strcmp (data, "CUSTOMFONTDIR") == 0)
+ {
+ FcStrFree (data);
+ data = malloc (1000);
+ if (!data)
+ {
+ FcConfigMessage (parse, FcSevereError, "out of memory");
+ break;
+ }
+ FcMemAlloc (FC_MEM_STRING, 1000);
+ if(!GetModuleFileName(NULL, data, 1000))
+ {
+ FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed");
+ FcStrFree (data);
+ break;
+ }
+ char *p = strrchr (data, '\\');
+ if (p) *p = '\0';
+ strcat (data, "\\fonts");
+ }
+ else if (strcmp (data, "WINDOWSFONTDIR") == 0)
{
int rc;
FcStrFree (data);