aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fcdir.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-06-26 09:30:29 +0200
committermarha <marha@users.sourceforge.net>2014-06-26 09:30:29 +0200
commitc30d5eefc96925b4bef781806c7a0114eca1b8e0 (patch)
tree420bb99ba463e5df728e71214ea6aaed0ad18fcb /fontconfig/src/fcdir.c
parentd435b20322433b335a4fc5693cce0399a3f27b2d (diff)
downloadvcxsrv-c30d5eefc96925b4bef781806c7a0114eca1b8e0.tar.gz
vcxsrv-c30d5eefc96925b4bef781806c7a0114eca1b8e0.tar.bz2
vcxsrv-c30d5eefc96925b4bef781806c7a0114eca1b8e0.zip
Opdated to openssl-1.0.1h
xkeyboard-config fontconfig libX11 libxcb xcb-proto mesa xserver git update 26 June 2014 xserver commit a3b44ad8db1fa2f3b81c1ff9498f31c5323edd37 libxcb commit 125135452a554e89e49448e2c1ee6658324e1095 libxcb/xcb-proto commit 84bfd909bc3774a459b11614cfebeaa584a1eb38 xkeyboard-config commit 39a226707b133ab5540c2d30176cb3857e74dcca libX11 commit a4679baaa18142576d42d423afe816447f08336c fontconfig commit 274f2181f294af2eff3e8db106ec8d7bab2d3ff1 mesa commit 9a8acafa47558cafeb37f80f4b30061ac1962c69
Diffstat (limited to 'fontconfig/src/fcdir.c')
-rw-r--r--fontconfig/src/fcdir.c84
1 files changed, 73 insertions, 11 deletions
diff --git a/fontconfig/src/fcdir.c b/fontconfig/src/fcdir.c
index 49259c1f2..593382f43 100644
--- a/fontconfig/src/fcdir.c
+++ b/fontconfig/src/fcdir.c
@@ -69,6 +69,7 @@ FcFileScanFontConfig (FcFontSet *set,
FcBool ret = FcTrue;
int id;
int count = 0;
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
id = 0;
do
@@ -85,6 +86,28 @@ FcFileScanFontConfig (FcFontSet *set,
font = FcFreeTypeQuery (file, id, blanks, &count);
if (FcDebug () & FC_DBG_SCAN)
printf ("done\n");
+ /*
+ * Get rid of sysroot here so that targeting scan rule may contains FC_FILE pattern
+ * and they should usually expect without sysroot.
+ */
+ if (sysroot)
+ {
+ size_t len = strlen ((const char *)sysroot);
+ FcChar8 *f = NULL;
+
+ if (FcPatternObjectGetString (font, FC_FILE_OBJECT, 0, &f) == FcResultMatch &&
+ strncmp ((const char *)f, (const char *)sysroot, len) == 0)
+ {
+ FcChar8 *s = FcStrdup (f);
+ FcPatternObjectDel (font, FC_FILE_OBJECT);
+ if (s[len] != '/')
+ len--;
+ else if (s[len+1] == '/')
+ len++;
+ FcPatternObjectAddString (font, FC_FILE_OBJECT, &s[len]);
+ FcStrFree (s);
+ }
+ }
/*
* Edit pattern with user-defined rules
@@ -128,7 +151,25 @@ FcFileScanConfig (FcFontSet *set,
FcConfig *config)
{
if (FcFileIsDir (file))
- return FcStrSetAdd (dirs, file);
+ {
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ const FcChar8 *d = file;
+ size_t len;
+
+ if (sysroot)
+ {
+ len = strlen ((const char *)sysroot);
+ if (strncmp ((const char *)file, (const char *)sysroot, len) == 0)
+ {
+ if (file[len] != '/')
+ len--;
+ else if (file[len+1] == '/')
+ len++;
+ d = &file[len];
+ }
+ }
+ return FcStrSetAdd (dirs, d);
+ }
else
{
if (set)
@@ -238,7 +279,7 @@ FcDirScanConfig (FcFontSet *set,
if (scanOnly)
{
if (FcFileIsDir (files->strs[i]))
- FcStrSetAdd (dirs, files->strs[i]);
+ FcFileScanConfig (NULL, dirs, NULL, files->strs[i], config);
}
else
{
@@ -273,9 +314,10 @@ FcDirScan (FcFontSet *set,
FcBool
FcDirScanOnly (FcStrSet *dirs,
- const FcChar8 *dir)
+ const FcChar8 *dir,
+ FcConfig *config)
{
- return FcDirScanConfig (NULL, dirs, NULL, dir, FcTrue, NULL, FcTrue);
+ return FcDirScanConfig (NULL, dirs, NULL, dir, FcTrue, config, FcTrue);
}
/*
@@ -288,11 +330,18 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
FcFontSet *set;
FcCache *cache = NULL;
struct stat dir_stat;
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcChar8 *d;
+
+ if (sysroot)
+ d = FcStrBuildFilename (sysroot, dir, NULL);
+ else
+ d = FcStrdup (dir);
if (FcDebug () & FC_DBG_FONTSET)
- printf ("cache scan dir %s\n", dir);
+ printf ("cache scan dir %s\n", d);
- if (FcStatChecksum (dir, &dir_stat) < 0)
+ if (FcStatChecksum (d, &dir_stat) < 0)
goto bail;
set = FcFontSetCreate();
@@ -306,7 +355,7 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
/*
* Scan the dir
*/
- if (!FcDirScanConfig (set, dirs, NULL, dir, FcTrue, config, FcFalse))
+ if (!FcDirScanConfig (set, dirs, NULL, d, FcTrue, config, FcFalse))
goto bail2;
/*
@@ -326,20 +375,30 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
bail1:
FcFontSetDestroy (set);
bail:
+ FcStrFree (d);
+
return cache;
}
FcCache *
FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
{
- FcCache *cache = FcDirCacheLoad (dir, config, NULL);
+ FcCache *cache;
FcCache *new = NULL;
struct stat dir_stat;
FcStrSet *dirs;
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcChar8 *d = NULL;
+ cache = FcDirCacheLoad (dir, config, NULL);
if (!cache)
- return NULL;
- if (FcStatChecksum (dir, &dir_stat) < 0)
+ goto bail;
+
+ if (sysroot)
+ d = FcStrBuildFilename (sysroot, dir, NULL);
+ else
+ d = FcStrdup (dir);
+ if (FcStatChecksum (d, &dir_stat) < 0)
goto bail;
dirs = FcStrSetCreate ();
if (!dirs)
@@ -348,7 +407,7 @@ FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
/*
* Scan the dir
*/
- if (!FcDirScanConfig (NULL, dirs, NULL, dir, FcTrue, config, FcFalse))
+ if (!FcDirScanConfig (NULL, dirs, NULL, d, FcTrue, config, FcFalse))
goto bail1;
/*
* Rebuild the cache object
@@ -365,6 +424,9 @@ FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
bail1:
FcStrSetDestroy (dirs);
bail:
+ if (d)
+ FcStrFree (d);
+
return new;
}