aboutsummaryrefslogtreecommitdiff
path: root/fontconfig
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig')
-rw-r--r--fontconfig/doc/fontconfig-devel.sgml2
-rw-r--r--fontconfig/fc-cache/fc-cache.c10
-rw-r--r--fontconfig/fc-case/CaseFolding.txt59
-rw-r--r--fontconfig/fc-lang/ko.orth1
-rw-r--r--fontconfig/fontconfig/fontconfig.h2
-rw-r--r--fontconfig/fonts.conf.in24
-rw-r--r--fontconfig/src/Makefile.am1
-rw-r--r--fontconfig/src/fccache.c76
-rw-r--r--fontconfig/src/fccfg.c2
-rw-r--r--fontconfig/src/fcdir.c84
-rw-r--r--fontconfig/src/fcfreetype.c49
-rw-r--r--fontconfig/src/fchash.c189
-rw-r--r--fontconfig/src/fcinit.c17
-rw-r--r--fontconfig/src/fcint.h22
-rw-r--r--fontconfig/src/fcobjs.h4
-rw-r--r--fontconfig/src/fcxml.c12
16 files changed, 230 insertions, 324 deletions
diff --git a/fontconfig/doc/fontconfig-devel.sgml b/fontconfig/doc/fontconfig-devel.sgml
index e2cb1c281..2b1122f18 100644
--- a/fontconfig/doc/fontconfig-devel.sgml
+++ b/fontconfig/doc/fontconfig-devel.sgml
@@ -198,7 +198,7 @@ convenience for the application's rendering mechanism.
stylelang and fullnamelang
prgname FC_PRGNAME String Name of the running program
hash FC_HASH String SHA256 hash value of the font data
- with "sha256:" prefix.
+ with "sha256:" prefix (deprecated)
postscriptname FC_POSTSCRIPT_NAME String Font name in PostScript
</programlisting>
</sect2>
diff --git a/fontconfig/fc-cache/fc-cache.c b/fontconfig/fc-cache/fc-cache.c
index 90ebad32f..406ac6a8a 100644
--- a/fontconfig/fc-cache/fc-cache.c
+++ b/fontconfig/fc-cache/fc-cache.c
@@ -128,7 +128,8 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
struct stat statb;
FcBool was_valid;
int i;
-
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+
/*
* Now scan all of the directories into separate databases
* and write out the results
@@ -138,9 +139,10 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
if (verbose)
{
if (!recursive)
- printf ("Re-scanning %s: ", dir);
- else
- printf ("%s: ", dir);
+ printf ("Re-scanning ");
+ if (sysroot)
+ printf ("[%s]", sysroot);
+ printf ("%s: ", dir);
fflush (stdout);
}
diff --git a/fontconfig/fc-case/CaseFolding.txt b/fontconfig/fc-case/CaseFolding.txt
index cf5779f40..13c10a6c4 100644
--- a/fontconfig/fc-case/CaseFolding.txt
+++ b/fontconfig/fc-case/CaseFolding.txt
@@ -1,8 +1,8 @@
-# CaseFolding-6.3.0.txt
-# Date: 2012-12-20, 22:14:35 GMT [MD]
+# CaseFolding-7.0.0.txt
+# Date: 2014-04-09, 20:00:56 GMT [MD]
#
# Unicode Character Database
-# Copyright (c) 1991-2013 Unicode, Inc.
+# Copyright (c) 1991-2014 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
# For documentation, see http://www.unicode.org/reports/tr44/
#
@@ -25,7 +25,7 @@
#
# For information on case folding, including how to have case folding
# preserve normalization formats, see Section 3.13 Default Case Algorithms in
-# The Unicode Standard, Version 5.0.
+# The Unicode Standard.
#
# ================================================================================
# Format
@@ -58,8 +58,6 @@
# All code points not explicitly listed for Case_Folding
# have the value C for the status field, and the code point itself for the mapping field.
-# @missing: 0000..10FFFF; C; <code point>
-
# =================================================================
0041; C; 0061; # LATIN CAPITAL LETTER A
0042; C; 0062; # LATIN CAPITAL LETTER B
@@ -298,6 +296,7 @@
0370; C; 0371; # GREEK CAPITAL LETTER HETA
0372; C; 0373; # GREEK CAPITAL LETTER ARCHAIC SAMPI
0376; C; 0377; # GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA
+037F; C; 03F3; # GREEK CAPITAL LETTER YOT
0386; C; 03AC; # GREEK CAPITAL LETTER ALPHA WITH TONOS
0388; C; 03AD; # GREEK CAPITAL LETTER EPSILON WITH TONOS
0389; C; 03AE; # GREEK CAPITAL LETTER ETA WITH TONOS
@@ -505,6 +504,10 @@
0522; C; 0523; # CYRILLIC CAPITAL LETTER EN WITH MIDDLE HOOK
0524; C; 0525; # CYRILLIC CAPITAL LETTER PE WITH DESCENDER
0526; C; 0527; # CYRILLIC CAPITAL LETTER SHHA WITH DESCENDER
+0528; C; 0529; # CYRILLIC CAPITAL LETTER EN WITH LEFT HOOK
+052A; C; 052B; # CYRILLIC CAPITAL LETTER DZZHE
+052C; C; 052D; # CYRILLIC CAPITAL LETTER DCHE
+052E; C; 052F; # CYRILLIC CAPITAL LETTER EL WITH DESCENDER
0531; C; 0561; # ARMENIAN CAPITAL LETTER AYB
0532; C; 0562; # ARMENIAN CAPITAL LETTER BEN
0533; C; 0563; # ARMENIAN CAPITAL LETTER GIM
@@ -1088,6 +1091,8 @@ A690; C; A691; # CYRILLIC CAPITAL LETTER TSSE
A692; C; A693; # CYRILLIC CAPITAL LETTER TCHE
A694; C; A695; # CYRILLIC CAPITAL LETTER HWE
A696; C; A697; # CYRILLIC CAPITAL LETTER SHWE
+A698; C; A699; # CYRILLIC CAPITAL LETTER DOUBLE O
+A69A; C; A69B; # CYRILLIC CAPITAL LETTER CROSSED O
A722; C; A723; # LATIN CAPITAL LETTER EGYPTOLOGICAL ALEF
A724; C; A725; # LATIN CAPITAL LETTER EGYPTOLOGICAL AIN
A726; C; A727; # LATIN CAPITAL LETTER HENG
@@ -1138,12 +1143,22 @@ A78B; C; A78C; # LATIN CAPITAL LETTER SALTILLO
A78D; C; 0265; # LATIN CAPITAL LETTER TURNED H
A790; C; A791; # LATIN CAPITAL LETTER N WITH DESCENDER
A792; C; A793; # LATIN CAPITAL LETTER C WITH BAR
+A796; C; A797; # LATIN CAPITAL LETTER B WITH FLOURISH
+A798; C; A799; # LATIN CAPITAL LETTER F WITH STROKE
+A79A; C; A79B; # LATIN CAPITAL LETTER VOLAPUK AE
+A79C; C; A79D; # LATIN CAPITAL LETTER VOLAPUK OE
+A79E; C; A79F; # LATIN CAPITAL LETTER VOLAPUK UE
A7A0; C; A7A1; # LATIN CAPITAL LETTER G WITH OBLIQUE STROKE
A7A2; C; A7A3; # LATIN CAPITAL LETTER K WITH OBLIQUE STROKE
A7A4; C; A7A5; # LATIN CAPITAL LETTER N WITH OBLIQUE STROKE
A7A6; C; A7A7; # LATIN CAPITAL LETTER R WITH OBLIQUE STROKE
A7A8; C; A7A9; # LATIN CAPITAL LETTER S WITH OBLIQUE STROKE
A7AA; C; 0266; # LATIN CAPITAL LETTER H WITH HOOK
+A7AB; C; 025C; # LATIN CAPITAL LETTER REVERSED OPEN E
+A7AC; C; 0261; # LATIN CAPITAL LETTER SCRIPT G
+A7AD; C; 026C; # LATIN CAPITAL LETTER L WITH BELT
+A7B0; C; 029E; # LATIN CAPITAL LETTER TURNED K
+A7B1; C; 0287; # LATIN CAPITAL LETTER TURNED T
FB00; F; 0066 0066; # LATIN SMALL LIGATURE FF
FB01; F; 0066 0069; # LATIN SMALL LIGATURE FI
FB02; F; 0066 006C; # LATIN SMALL LIGATURE FL
@@ -1222,5 +1237,37 @@ FF3A; C; FF5A; # FULLWIDTH LATIN CAPITAL LETTER Z
10425; C; 1044D; # DESERET CAPITAL LETTER ENG
10426; C; 1044E; # DESERET CAPITAL LETTER OI
10427; C; 1044F; # DESERET CAPITAL LETTER EW
+118A0; C; 118C0; # WARANG CITI CAPITAL LETTER NGAA
+118A1; C; 118C1; # WARANG CITI CAPITAL LETTER A
+118A2; C; 118C2; # WARANG CITI CAPITAL LETTER WI
+118A3; C; 118C3; # WARANG CITI CAPITAL LETTER YU
+118A4; C; 118C4; # WARANG CITI CAPITAL LETTER YA
+118A5; C; 118C5; # WARANG CITI CAPITAL LETTER YO
+118A6; C; 118C6; # WARANG CITI CAPITAL LETTER II
+118A7; C; 118C7; # WARANG CITI CAPITAL LETTER UU
+118A8; C; 118C8; # WARANG CITI CAPITAL LETTER E
+118A9; C; 118C9; # WARANG CITI CAPITAL LETTER O
+118AA; C; 118CA; # WARANG CITI CAPITAL LETTER ANG
+118AB; C; 118CB; # WARANG CITI CAPITAL LETTER GA
+118AC; C; 118CC; # WARANG CITI CAPITAL LETTER KO
+118AD; C; 118CD; # WARANG CITI CAPITAL LETTER ENY
+118AE; C; 118CE; # WARANG CITI CAPITAL LETTER YUJ
+118AF; C; 118CF; # WARANG CITI CAPITAL LETTER UC
+118B0; C; 118D0; # WARANG CITI CAPITAL LETTER ENN
+118B1; C; 118D1; # WARANG CITI CAPITAL LETTER ODD
+118B2; C; 118D2; # WARANG CITI CAPITAL LETTER TTE
+118B3; C; 118D3; # WARANG CITI CAPITAL LETTER NUNG
+118B4; C; 118D4; # WARANG CITI CAPITAL LETTER DA
+118B5; C; 118D5; # WARANG CITI CAPITAL LETTER AT
+118B6; C; 118D6; # WARANG CITI CAPITAL LETTER AM
+118B7; C; 118D7; # WARANG CITI CAPITAL LETTER BU
+118B8; C; 118D8; # WARANG CITI CAPITAL LETTER PU
+118B9; C; 118D9; # WARANG CITI CAPITAL LETTER HIYO
+118BA; C; 118DA; # WARANG CITI CAPITAL LETTER HOLO
+118BB; C; 118DB; # WARANG CITI CAPITAL LETTER HORR
+118BC; C; 118DC; # WARANG CITI CAPITAL LETTER HAR
+118BD; C; 118DD; # WARANG CITI CAPITAL LETTER SSUU
+118BE; C; 118DE; # WARANG CITI CAPITAL LETTER SII
+118BF; C; 118DF; # WARANG CITI CAPITAL LETTER VIYO
#
# EOF
diff --git a/fontconfig/fc-lang/ko.orth b/fontconfig/fc-lang/ko.orth
index 39114a5af..4bb52c6f4 100644
--- a/fontconfig/fc-lang/ko.orth
+++ b/fontconfig/fc-lang/ko.orth
@@ -86,7 +86,6 @@
0x3161 # HANGUL LETTER EU
0x3162 # HANGUL LETTER YI
0x3163 # HANGUL LETTER I
-0x3164 # HANGUL FILLER
0x3165 # HANGUL LETTER SSANGNIEUN
0x3166 # HANGUL LETTER NIEUN-TIKEUT
0x3167 # HANGUL LETTER NIEUN-SIOS
diff --git a/fontconfig/fontconfig/fontconfig.h b/fontconfig/fontconfig/fontconfig.h
index 069cb60dd..8575cc4d3 100644
--- a/fontconfig/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig/fontconfig.h
@@ -115,7 +115,7 @@ typedef int FcBool;
#define FC_FONT_FEATURES "fontfeatures" /* String */
#define FC_NAMELANG "namelang" /* String RFC 3866 langs */
#define FC_PRGNAME "prgname" /* String */
-#define FC_HASH "hash" /* String */
+#define FC_HASH "hash" /* String (deprecated) */
#define FC_POSTSCRIPT_NAME "postscriptname" /* String */
#define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION
diff --git a/fontconfig/fonts.conf.in b/fontconfig/fonts.conf.in
index 6a8753d01..f63ada1cd 100644
--- a/fontconfig/fonts.conf.in
+++ b/fontconfig/fonts.conf.in
@@ -88,17 +88,15 @@
<int>0x00A0</int> <!-- NO-BREAK SPACE -->
<int>0x00AD</int> <!-- SOFT HYPHEN -->
<int>0x034F</int> <!-- COMBINING GRAPHEME JOINER -->
- <int>0x0600</int> <!-- ARABIC NUMBER SIGN -->
- <int>0x0601</int> <!-- ARABIC SIGN SANAH -->
- <int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER -->
- <int>0x0603</int> <!-- ARABIC SIGN SAFHA -->
- <int>0x06DD</int> <!-- ARABIC END OF AYAH -->
- <int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK -->
+ <int>0x061C</int> <!-- ARABIC LETTER MARK -->
<int>0x115F</int> <!-- HANGUL CHOSEONG FILLER -->
<int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER -->
<int>0x1680</int> <!-- OGHAM SPACE MARK -->
<int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ -->
<int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA -->
+ <int>0x180B</int> <!-- MONGOLIAN FREE VARIATION SELECTOR ONE -->
+ <int>0x180C</int> <!-- MONGOLIAN FREE VARIATION SELECTOR TWO -->
+ <int>0x180D</int> <!-- MONGOLIAN FREE VARIATION SELECTOR THREE -->
<int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR -->
<int>0x2000</int> <!-- EN QUAD -->
<int>0x2001</int> <!-- EM QUAD -->
@@ -116,8 +114,6 @@
<int>0x200D</int> <!-- ZERO WIDTH JOINER -->
<int>0x200E</int> <!-- LEFT-TO-RIGHT MARK -->
<int>0x200F</int> <!-- RIGHT-TO-LEFT MARK -->
- <int>0x2028</int> <!-- LINE SEPARATOR -->
- <int>0x2029</int> <!-- PARAGRAPH SEPARATOR -->
<int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING -->
<int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING -->
<int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING -->
@@ -129,6 +125,11 @@
<int>0x2061</int> <!-- FUNCTION APPLICATION -->
<int>0x2062</int> <!-- INVISIBLE TIMES -->
<int>0x2063</int> <!-- INVISIBLE SEPARATOR -->
+ <int>0x2064</int> <!-- INVISIBLE PLUS -->
+ <int>0x2066</int> <!-- LEFT-TO-RIGHT ISOLATE -->
+ <int>0x2067</int> <!-- RIGHT-TO-LEFT ISOLATE -->
+ <int>0x2068</int> <!-- FIRST STRONG ISOLATE -->
+ <int>0x2069</int> <!-- POP DIRECTIONAL ISOLATE -->
<int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING -->
<int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING -->
<int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING -->
@@ -140,9 +141,10 @@
<int>0x3164</int> <!-- HANGUL FILLER -->
<int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE -->
<int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER -->
- <int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR -->
- <int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR -->
- <int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR -->
+ <int>0x1BCA0</int> <!-- SHORTHAND FORMAT LETTER OVERLAP -->
+ <int>0x1BCA1</int> <!-- SHORTHAND FORMAT CONTINUING OVERLAP -->
+ <int>0x1BCA2</int> <!-- SHORTHAND FORMAT DOWN STEP -->
+ <int>0x1BCA3</int> <!-- SHORTHAND FORMAT UP STEP -->
</blank>
<!--
Rescan configuration every 30 seconds when FcFontSetList is called
diff --git a/fontconfig/src/Makefile.am b/fontconfig/src/Makefile.am
index be20eba05..c1991b284 100644
--- a/fontconfig/src/Makefile.am
+++ b/fontconfig/src/Makefile.am
@@ -139,7 +139,6 @@ libfontconfig_la_SOURCES = \
fcformat.c \
fcfreetype.c \
fcfs.c \
- fchash.c \
fcinit.c \
fclang.c \
fclist.c \
diff --git a/fontconfig/src/fccache.c b/fontconfig/src/fccache.c
index 085bd72e3..25538bd70 100644
--- a/fontconfig/src/fccache.c
+++ b/fontconfig/src/fccache.c
@@ -177,19 +177,28 @@ FcDirCacheOpenFile (const FcChar8 *cache_file, struct stat *file_stat)
*/
static FcBool
FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
- FcBool (*callback) (int fd, struct stat *fd_stat,
+ FcBool (*callback) (FcConfig *config, int fd, struct stat *fd_stat,
struct stat *dir_stat, void *closure),
void *closure, FcChar8 **cache_file_ret)
{
int fd = -1;
FcChar8 cache_base[CACHEBASE_LEN];
FcStrList *list;
- FcChar8 *cache_dir;
+ FcChar8 *cache_dir, *d;
struct stat file_stat, dir_stat;
FcBool ret = FcFalse;
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
- if (FcStatChecksum (dir, &dir_stat) < 0)
+ if (sysroot)
+ d = FcStrBuildFilename (sysroot, dir, NULL);
+ else
+ d = FcStrdup (dir);
+ if (FcStatChecksum (d, &dir_stat) < 0)
+ {
+ FcStrFree (d);
return FcFalse;
+ }
+ FcStrFree (d);
FcDirCacheBasename (dir, cache_base);
@@ -199,7 +208,6 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
while ((cache_dir = FcStrListNext (list)))
{
- const FcChar8 *sysroot = FcConfigGetSysRoot (config);
FcChar8 *cache_hashed;
if (sysroot)
@@ -210,7 +218,7 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
break;
fd = FcDirCacheOpenFile (cache_hashed, &file_stat);
if (fd >= 0) {
- ret = (*callback) (fd, &file_stat, &dir_stat, closure);
+ ret = (*callback) (config, fd, &file_stat, &dir_stat, closure);
close (fd);
if (ret)
{
@@ -529,14 +537,25 @@ FcCacheFini (void)
}
static FcBool
-FcCacheTimeValid (FcCache *cache, struct stat *dir_stat)
+FcCacheTimeValid (FcConfig *config, FcCache *cache, struct stat *dir_stat)
{
struct stat dir_static;
if (!dir_stat)
{
- if (FcStatChecksum (FcCacheDir (cache), &dir_static) < 0)
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcChar8 *d;
+
+ if (sysroot)
+ d = FcStrBuildFilename (sysroot, FcCacheDir (cache), NULL);
+ else
+ d = FcStrdup (FcCacheDir (cache));
+ if (FcStatChecksum (d, &dir_static) < 0)
+ {
+ FcStrFree (d);
return FcFalse;
+ }
+ FcStrFree (d);
dir_stat = &dir_static;
}
if (FcDebug () & FC_DBG_CACHE)
@@ -546,21 +565,28 @@ FcCacheTimeValid (FcCache *cache, struct stat *dir_stat)
}
static FcBool
-FcCacheDirsValid (FcCache *cache)
+FcCacheDirsValid (FcConfig *config, FcCache *cache)
{
FcStrSet *dirs = FcStrSetCreate ();
FcBool ret = FcFalse;
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcChar8 *d;
if (!dirs)
goto bail;
- if (!FcDirScanOnly (dirs, FcCacheDir (cache)))
+ if (sysroot)
+ d = FcStrBuildFilename (sysroot, FcCacheDir (cache), NULL);
+ else
+ d = FcStrdup (FcCacheDir (cache));
+ if (!FcDirScanOnly (dirs, d, config))
goto bail1;
ret = cache->dirs_count == dirs->num;
if (FcDebug () & FC_DBG_CACHE)
- printf ("%s: cache: %d, fs: %d\n", FcCacheDir (cache), cache->dirs_count, dirs->num);
+ printf ("%s: cache: %d, fs: %d\n", d, cache->dirs_count, dirs->num);
bail1:
FcStrSetDestroy (dirs);
+ FcStrFree (d);
bail:
return ret;
}
@@ -569,7 +595,7 @@ bail:
* Map a cache file into memory
*/
static FcCache *
-FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
+FcDirCacheMapFd (FcConfig *config, int fd, struct stat *fd_stat, struct stat *dir_stat)
{
FcCache *cache;
FcBool allocated = FcFalse;
@@ -579,8 +605,8 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
cache = FcCacheFindByStat (fd_stat);
if (cache)
{
- if (FcCacheTimeValid (cache, dir_stat) &&
- FcCacheDirsValid (cache))
+ if (FcCacheTimeValid (config, cache, dir_stat) &&
+ FcCacheDirsValid (config, cache))
return cache;
FcDirCacheUnload (cache);
cache = NULL;
@@ -631,8 +657,8 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
if (cache->magic != FC_CACHE_MAGIC_MMAP ||
cache->version < FC_CACHE_CONTENT_VERSION ||
cache->size != (intptr_t) fd_stat->st_size ||
- !FcCacheTimeValid (cache, dir_stat) ||
- !FcCacheDirsValid (cache) ||
+ !FcCacheTimeValid (config, cache, dir_stat) ||
+ !FcCacheDirsValid (config, cache) ||
!FcCacheInsert (cache, fd_stat))
{
if (allocated)
@@ -671,9 +697,9 @@ FcDirCacheUnload (FcCache *cache)
}
static FcBool
-FcDirCacheMapHelper (int fd, struct stat *fd_stat, struct stat *dir_stat, void *closure)
+FcDirCacheMapHelper (FcConfig *config, int fd, struct stat *fd_stat, struct stat *dir_stat, void *closure)
{
- FcCache *cache = FcDirCacheMapFd (fd, fd_stat, dir_stat);
+ FcCache *cache = FcDirCacheMapFd (config, fd, fd_stat, dir_stat);
if (!cache)
return FcFalse;
@@ -690,6 +716,7 @@ FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file)
FcDirCacheMapHelper,
&cache, cache_file))
return NULL;
+
return cache;
}
@@ -705,7 +732,7 @@ FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
fd = FcDirCacheOpenFile (cache_file, file_stat);
if (fd < 0)
return NULL;
- cache = FcDirCacheMapFd (fd, file_stat, NULL);
+ cache = FcDirCacheMapFd (FcConfigGetCurrent (), fd, file_stat, NULL);
close (fd);
return cache;
}
@@ -715,7 +742,7 @@ FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
* the magic number and the size field
*/
static FcBool
-FcDirCacheValidateHelper (int fd, struct stat *fd_stat, struct stat *dir_stat, void *closure FC_UNUSED)
+FcDirCacheValidateHelper (FcConfig *config, int fd, struct stat *fd_stat, struct stat *dir_stat, void *closure FC_UNUSED)
{
FcBool ret = FcTrue;
FcCache c;
@@ -1080,15 +1107,22 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose)
}
else
{
+ FcChar8 *s;
+
target_dir = FcCacheDir (cache);
- if (stat ((char *) target_dir, &target_stat) < 0)
+ if (sysroot)
+ s = FcStrBuildFilename (sysroot, target_dir, NULL);
+ else
+ s = FcStrdup (target_dir);
+ if (stat ((char *) s, &target_stat) < 0)
{
if (verbose || FcDebug () & FC_DBG_CACHE)
printf ("%s: %s: missing directory: %s \n",
- dir, ent->d_name, target_dir);
+ dir, ent->d_name, s);
remove = FcTrue;
}
FcDirCacheUnload (cache);
+ FcStrFree (s);
}
if (remove)
{
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index fe69eecd7..8b62e520c 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -375,7 +375,7 @@ FcConfigAddDirList (FcConfig *config, FcSetName set, FcStrSet *dirSet)
while ((dir = FcStrListNext (dirlist)))
{
if (FcDebug () & FC_DBG_FONTSET)
- printf ("adding fonts from%s\n", dir);
+ printf ("adding fonts from %s\n", dir);
cache = FcDirCacheRead (dir, FcFalse, config);
if (!cache)
continue;
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;
}
diff --git a/fontconfig/src/fcfreetype.c b/fontconfig/src/fcfreetype.c
index ae19ae91b..3eb409160 100644
--- a/fontconfig/src/fcfreetype.c
+++ b/fontconfig/src/fcfreetype.c
@@ -1698,55 +1698,6 @@ FcFreeTypeQueryFace (const FT_Face face,
/*
- * Compute hash digest for the font
- */
- {
- FcChar8 *hashstr = NULL;
- FcHashDigest digest;
-
- FcHashInitDigest (digest);
-
- if (face->stream->read == NULL)
- {
- const char *data = (const char *) face->stream->base;
- size_t total_len = face->stream->size;
- size_t len = total_len;
-
- while (len >= 64)
- {
- FcHashDigestAddBlock (digest, data);
- data += 64;
- len -= 64;
- }
- FcHashDigestFinish (digest, data, total_len);
- } else {
- char data[64];
- size_t total_len = 0;
- size_t len = 0;
-
- while ((len = face->stream->read (face->stream, total_len, (unsigned char *) data, sizeof(data))) == 64)
- {
- FcHashDigestAddBlock (digest, data);
- total_len += 64;
- }
- total_len += len;
- FcHashDigestFinish (digest, data, total_len);
- }
-
- hashstr = FcHashToString (digest);
- if (hashstr)
- {
- if (!FcPatternAddString (pat, FC_HASH, hashstr))
- {
- free (hashstr);
- goto bail1;
- }
- free (hashstr);
- }
- }
-
-
- /*
* Compute the unicode coverage for the font
*/
cs = FcFreeTypeCharSetAndSpacing (face, blanks, &spacing);
diff --git a/fontconfig/src/fchash.c b/fontconfig/src/fchash.c
deleted file mode 100644
index 1526cfd2b..000000000
--- a/fontconfig/src/fchash.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * fontconfig/src/fchash.c
- *
- * Copyright © 2003 Keith Packard
- * Copyright © 2013 Red Hat, Inc.
- * Copyright © 2014 Google, Inc.
- * Red Hat Author(s): Akira TAGOH
- * Google Author(s): Behdad Esfahbod
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the author(s) not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The authors make no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-#include "fcint.h"
-#include <stdio.h>
-#include <string.h>
-
-/* SHA256 */
-
-
-#define ROTRN(w, v, n) ((((FcChar32)v) >> n) | (((FcChar32)v) << (w - n)))
-#define ROTR32(v, n) ROTRN(32, v, n)
-#define SHR(v, n) (v >> n)
-#define Ch(x, y, z) ((x & y) ^ (~x & z))
-#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
-#define SS0(x) (ROTR32(x, 2) ^ ROTR32(x, 13) ^ ROTR32(x, 22))
-#define SS1(x) (ROTR32(x, 6) ^ ROTR32(x, 11) ^ ROTR32(x, 25))
-#define ss0(x) (ROTR32(x, 7) ^ ROTR32(x, 18) ^ SHR(x, 3))
-#define ss1(x) (ROTR32(x, 17) ^ ROTR32(x, 19) ^ SHR(x, 10))
-
-
-
-void
-FcHashInitDigest (FcHashDigest digest)
-{
- static const FcHashDigest init = {
- 0x6a09e667UL, 0xbb67ae85UL, 0x3c6ef372UL, 0xa54ff53aUL,
- 0x510e527fUL, 0x9b05688cUL, 0x1f83d9abUL, 0x5be0cd19UL
- };
-
- memcpy (digest, init, sizeof (FcHashDigest));
-}
-
-void
-FcHashDigestAddBlock (FcHashDigest digest,
- const char block[64])
-{
- static const FcChar32 k[] = {
- 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
- 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
- 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
- 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
- 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
- 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
- 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
- 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
- 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
- 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
- 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
- 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
- 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
- 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
- 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
- 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
- };
- FcChar32 w[64], i, j, t1, t2;
- FcChar32 a, b, c, d, e, f, g, h;
-
-#define H(n) (digest[n])
-
- a = H(0);
- b = H(1);
- c = H(2);
- d = H(3);
- e = H(4);
- f = H(5);
- g = H(6);
- h = H(7);
-
- for (i = 0; i < 16; i++)
- {
- j = (block[(i * 4) + 0] & 0xff) << (8 * 3);
- j |= (block[(i * 4) + 1] & 0xff) << (8 * 2);
- j |= (block[(i * 4) + 2] & 0xff) << (8 * 1);
- j |= (block[(i * 4) + 3] & 0xff);
- w[i] = j;
- }
- for (i = 16; i < 64; i++)
- w[i] = ss1(w[i - 2]) + w[i - 7] + ss0(w[i - 15]) + w[i - 16];
-
- for (i = 0; i < 64; i++)
- {
- t1 = h + SS1(e) + Ch(e, f, g) + k[i] + w[i];
- t2 = SS0(a) + Maj(a, b, c);
- h = g;
- g = f;
- f = e;
- e = d + t1;
- d = c;
- c = b;
- b = a;
- a = t1 + t2;
- }
-
- H(0) += a;
- H(1) += b;
- H(2) += c;
- H(3) += d;
- H(4) += e;
- H(5) += f;
- H(6) += g;
- H(7) += h;
-
-#undef H
-}
-
-void
-FcHashDigestFinish (FcHashDigest digest,
- const char *residual, /* < 64 bytes */
- size_t total_len)
-{
- char ibuf[64];
- unsigned int len = total_len % 64;
- uint64_t v;
-
- if (!len)
- return;
-
- memcpy (ibuf, residual, len);
- memset (ibuf + len, 0, 64 - len);
- ibuf[len] = 0x80;
-
- if ((64 - len) < 9)
- {
- FcHashDigestAddBlock (digest, ibuf);
- memset (ibuf, 0, 64);
- }
-
- /* set input size at the end */
- v = (uint64_t) total_len * 8;
- ibuf[63 - 0] = v & 0xff;
- ibuf[63 - 1] = (v >> 8) & 0xff;
- ibuf[63 - 2] = (v >> 16) & 0xff;
- ibuf[63 - 3] = (v >> 24) & 0xff;
- ibuf[63 - 4] = (v >> 32) & 0xff;
- ibuf[63 - 5] = (v >> 40) & 0xff;
- ibuf[63 - 6] = (v >> 48) & 0xff;
- ibuf[63 - 7] = (v >> 56) & 0xff;
- FcHashDigestAddBlock (digest, ibuf);
-}
-
-FcChar8 *
-FcHashToString (const FcHashDigest digest)
-{
- FcChar8 *ret = NULL;
- static const char hex[] = "0123456789abcdef";
- int i, j;
-
- ret = malloc (sizeof (FcChar8) * (8 * 8 + 7 + 1));
- if (!ret)
- return NULL;
- memcpy (ret, "sha256:", 7);
-#define H(n) digest[n]
- for (i = 0; i < 8; i++)
- {
- FcChar32 v = H(i);
-
- for (j = 0; j < 8; j++)
- ret[7 + (i * 8) + j] = hex[(v >> (28 - j * 4)) & 0xf];
- }
- ret[7 + i * 8] = 0;
-#undef H
-
- return ret;
-}
diff --git a/fontconfig/src/fcinit.c b/fontconfig/src/fcinit.c
index b8d5d060c..1e23c1fbb 100644
--- a/fontconfig/src/fcinit.c
+++ b/fontconfig/src/fcinit.c
@@ -36,13 +36,14 @@
#endif
static FcConfig *
-FcInitFallbackConfig (void)
+FcInitFallbackConfig (const FcChar8 *sysroot)
{
FcConfig *config;
config = FcConfigCreate ();
if (!config)
goto bail0;
+ FcConfigSetSysRoot (config, sysroot);
if (!FcConfigAddDir (config, (FcChar8 *) FC_DEFAULT_FONTS))
goto bail1;
if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR))
@@ -78,8 +79,12 @@ FcInitLoadOwnConfig (FcConfig *config)
if (!FcConfigParseAndLoad (config, 0, FcTrue))
{
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcConfig *fallback = FcInitFallbackConfig (sysroot);
+
FcConfigDestroy (config);
- return FcInitFallbackConfig ();
+
+ return fallback;
}
if (config->cacheDirs && config->cacheDirs->num == 0)
@@ -108,13 +113,19 @@ FcInitLoadOwnConfig (FcConfig *config)
if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR) ||
!FcConfigAddCacheDir (config, (FcChar8 *) prefix))
{
+ FcConfig *fallback;
+ const FcChar8 *sysroot;
+
bail:
+ sysroot = FcConfigGetSysRoot (config);
fprintf (stderr,
"Fontconfig error: out of memory");
if (prefix)
FcStrFree (prefix);
+ fallback = FcInitFallbackConfig (sysroot);
FcConfigDestroy (config);
- return FcInitFallbackConfig ();
+
+ return fallback;
}
FcStrFree (prefix);
}
diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h
index a1b147f1d..d3079edcc 100644
--- a/fontconfig/src/fcint.h
+++ b/fontconfig/src/fcint.h
@@ -854,7 +854,8 @@ FcDirScanConfig (FcFontSet *set,
FcPrivate FcBool
FcDirScanOnly (FcStrSet *dirs,
- const FcChar8 *dir);
+ const FcChar8 *dir,
+ FcConfig *config);
/* fcfont.c */
FcPrivate int
@@ -871,25 +872,6 @@ FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
FcPrivate FcFontSet *
FcFontSetDeserialize (const FcFontSet *set);
-/* fchash.c */
-
-typedef FcChar32 FcHashDigest[8];
-
-FcPrivate void
-FcHashInitDigest (FcHashDigest digest);
-
-FcPrivate void
-FcHashDigestAddBlock (FcHashDigest digest,
- const char block[64]);
-
-FcPrivate void
-FcHashDigestFinish (FcHashDigest digest,
- const char *residual, /* < 64 bytes */
- size_t total_len);
-
-FcPrivate FcChar8 *
-FcHashToString (const FcHashDigest digest);
-
/* fcinit.c */
FcPrivate FcConfig *
FcInitLoadOwnConfig (FcConfig *config);
diff --git a/fontconfig/src/fcobjs.h b/fontconfig/src/fcobjs.h
index 72e71f99c..dc3d83404 100644
--- a/fontconfig/src/fcobjs.h
+++ b/fontconfig/src/fcobjs.h
@@ -44,7 +44,7 @@ FC_OBJECT (AUTOHINT, FcTypeBool, NULL)
FC_OBJECT (GLOBAL_ADVANCE, FcTypeBool, NULL) /* deprecated */
FC_OBJECT (FILE, FcTypeString, FcCompareFilename)
FC_OBJECT (INDEX, FcTypeInteger, NULL)
-FC_OBJECT (RASTERIZER, FcTypeString, FcCompareString)
+FC_OBJECT (RASTERIZER, FcTypeString, FcCompareString) /* deprecated */
FC_OBJECT (OUTLINE, FcTypeBool, FcCompareBool)
FC_OBJECT (SCALABLE, FcTypeBool, FcCompareBool)
FC_OBJECT (DPI, FcTypeDouble, NULL)
@@ -66,6 +66,6 @@ FC_OBJECT (LCD_FILTER, FcTypeInteger, NULL)
FC_OBJECT (NAMELANG, FcTypeString, NULL)
FC_OBJECT (FONT_FEATURES, FcTypeString, NULL)
FC_OBJECT (PRGNAME, FcTypeString, NULL)
-FC_OBJECT (HASH, FcTypeString, FcCompareHash)
+FC_OBJECT (HASH, FcTypeString, FcCompareHash) /* deprecated */
FC_OBJECT (POSTSCRIPT_NAME, FcTypeString, FcComparePostScript)
/* ^-------------- Add new objects here. */
diff --git a/fontconfig/src/fcxml.c b/fontconfig/src/fcxml.c
index 9f4c2b062..e4c811cd5 100644
--- a/fontconfig/src/fcxml.c
+++ b/fontconfig/src/fcxml.c
@@ -3130,11 +3130,12 @@ FcConfigParseAndLoad (FcConfig *config,
{
XML_Parser p;
- FcChar8 *filename;
+ FcChar8 *filename, *f;
int fd;
int len;
FcConfigParse parse;
FcBool error = FcTrue;
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
#ifdef ENABLE_LIBXML2
xmlSAXHandler sax;
@@ -3159,9 +3160,14 @@ FcConfigParseAndLoad (FcConfig *config,
}
#endif
- filename = FcConfigFilename (name);
- if (!filename)
+ f = FcConfigFilename (name);
+ if (!f)
goto bail0;
+ if (sysroot)
+ filename = FcStrBuildFilename (sysroot, f, NULL);
+ else
+ filename = FcStrdup (f);
+ FcStrFree (f);
if (FcStrSetMember (config->configFiles, filename))
{