aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fcinit.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-21 09:28:15 +0200
committermarha <marha@users.sourceforge.net>2012-05-21 09:28:15 +0200
commitd4b066581bc9a4bf7b0a5ffa11ff0adb47d2075c (patch)
treedb56fe01d61a824e4bd975cbf8603b11e9c5ecdf /fontconfig/src/fcinit.c
parentd2dacc6bc44f7dc245dee6e66723013afb49cfb5 (diff)
parentf543ceaca6820260f15a4eff86938214cf43c7d2 (diff)
downloadvcxsrv-d4b066581bc9a4bf7b0a5ffa11ff0adb47d2075c.tar.gz
vcxsrv-d4b066581bc9a4bf7b0a5ffa11ff0adb47d2075c.tar.bz2
vcxsrv-d4b066581bc9a4bf7b0a5ffa11ff0adb47d2075c.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'fontconfig/src/fcinit.c')
-rw-r--r--fontconfig/src/fcinit.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/fontconfig/src/fcinit.c b/fontconfig/src/fcinit.c
index abf64b57f..ab6401215 100644
--- a/fontconfig/src/fcinit.c
+++ b/fontconfig/src/fcinit.c
@@ -72,21 +72,37 @@ FcInitLoadConfig (void)
if (config->cacheDirs && config->cacheDirs->num == 0)
{
+ FcChar8 *prefix;
+ size_t plen;
+
fprintf (stderr,
"Fontconfig warning: no <cachedir> elements found. Check configuration.\n");
fprintf (stderr,
"Fontconfig warning: adding <cachedir>%s</cachedir>\n",
FC_CACHEDIR);
+ prefix = FcConfigXdgCacheHome ();
+ plen = prefix ? strlen ((const char *)prefix) : 0;
+ if (!prefix)
+ goto bail;
+ prefix = realloc (prefix, plen + 12);
+ if (!prefix)
+ goto bail;
+ memcpy (&prefix[plen], FC_DIR_SEPARATOR_S "fontconfig", 11);
+ prefix[plen + 11] = 0;
fprintf (stderr,
- "Fontconfig warning: adding <cachedir>~/.fontconfig</cachedir>\n");
+ "Fontconfig warning: adding <cachedir prefix=\"xdg\">fontconfig</cachedir>\n");
+
if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR) ||
- !FcConfigAddCacheDir (config, (FcChar8 *) "~/.fontconfig"))
+ !FcConfigAddCacheDir (config, (FcChar8 *) prefix))
{
+ bail:
fprintf (stderr,
"Fontconfig error: out of memory");
+ free (prefix);
FcConfigDestroy (config);
return FcInitFallbackConfig ();
}
+ free (prefix);
}
return config;