diff options
Diffstat (limited to 'fontconfig')
-rw-r--r-- | fontconfig/README | 21 | ||||
-rw-r--r-- | fontconfig/conf.d/Makefile.am | 11 | ||||
-rw-r--r-- | fontconfig/conf.d/README.in (renamed from fontconfig/conf.d/README) | 6 | ||||
-rw-r--r-- | fontconfig/configure.ac | 2 | ||||
-rw-r--r-- | fontconfig/doc/fontconfig-devel.sgml | 3 | ||||
-rw-r--r-- | fontconfig/fontconfig/fontconfig.h | 2 | ||||
-rw-r--r-- | fontconfig/src/fcatomic.h | 14 | ||||
-rw-r--r-- | fontconfig/src/fccfg.c | 46 | ||||
-rw-r--r-- | fontconfig/src/fcfreetype.c | 45 | ||||
-rw-r--r-- | fontconfig/src/fchash.c | 57 | ||||
-rw-r--r-- | fontconfig/src/fcint.h | 9 | ||||
-rw-r--r-- | fontconfig/src/fcmatch.c | 32 | ||||
-rw-r--r-- | fontconfig/src/fcname.c | 6 | ||||
-rw-r--r-- | fontconfig/src/fcobjs.h | 2 | ||||
-rw-r--r-- | fontconfig/src/fcstr.c | 44 |
15 files changed, 224 insertions, 76 deletions
diff --git a/fontconfig/README b/fontconfig/README index a855f28ff..8120585a7 100644 --- a/fontconfig/README +++ b/fontconfig/README @@ -1,12 +1,29 @@ Fontconfig Font configuration and customization library - Version 2.10.92 (2.11 RC2) - 2013-03-29 + Version 2.10.93 (2.11 RC3) + 2013-05-20 Check INSTALL for compilation and installation instructions. Report bugs to https://bugs.freedesktop.org in the fontconfig module. +2.10.93 (2.11 RC3) + +Akira TAGOH (10): + Bug 62980 - matching native fonts with even :lang=en + Ensure closing fp on error + Obtain fonts data via FT_Face instead of opening a file directly + Revert the previous change and rework to not export freetype API outside fcfreetype.c + documented FC_HASH and FC_POSTSCRIPT_NAME + Bug 63329 - make check fails: .. contents:: :depth: 2 + Use the glob matching for filename + Bug 63452 - conf.d/README outdated + Fix missing OSAtomicCompareAndSwapPtrBarrier() on Mac OS X 10.4 + Bug 63922 - FcFreeTypeQueryFace fails on postscripts fonts loaded from memory + +Sebastian Freundt (1): + build-chain, replace INCLUDES directive by AM_CPPFLAGS + 2.10.92 (2.11 RC2) Akira TAGOH (33): diff --git a/fontconfig/conf.d/Makefile.am b/fontconfig/conf.d/Makefile.am index 77597e57f..e1fab5061 100644 --- a/fontconfig/conf.d/Makefile.am +++ b/fontconfig/conf.d/Makefile.am @@ -21,8 +21,9 @@ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -DOC_FILES= \ - README +BUILT_SOURCES = README +DOC_SOURCES = README.in +DOC_FILES = $(DOC_SOURCES:.in=) CONF_LINKS = \ 10-scale-bitmap-fonts.conf \ @@ -41,7 +42,8 @@ CONF_LINKS = \ 80-delicious.conf \ 90-synthetic.conf -EXTRA_DIST = $(template_DATA) $(DOC_FILES) +EXTRA_DIST = $(template_DATA) $(DOC_SOURCES) +CLEANFILES = $(DOC_FILES) configdir=$(CONFIGDIR) config_DATA = $(DOC_FILES) @@ -78,6 +80,9 @@ template_DATA = \ 80-delicious.conf \ 90-synthetic.conf +README: $(srcdir)/README.in + sed "s|\@TEMPLATEDIR\@|$(templatedir)|" $< > $@ + install-data-hook: mkdir -p $(DESTDIR)$(configdir) @(echo cd $(DESTDIR)$(configdir); \ diff --git a/fontconfig/conf.d/README b/fontconfig/conf.d/README.in index c2fb52c3b..90c45de52 100644 --- a/fontconfig/conf.d/README +++ b/fontconfig/conf.d/README.in @@ -2,9 +2,9 @@ conf.d/README Each file in this directory is a fontconfig configuration file. Fontconfig scans this directory, loading all files of the form [0-9][0-9]*.conf. -These files are normally installed in ../conf.avail and then symlinked here, -allowing them to be easily installed and then enabled/disabled by adjusting -the symlinks. +These files are normally installed in @TEMPLATEDIR@ +and then symlinked here, allowing them to be easily installed and then +enabled/disabled by adjusting the symlinks. The files are loaded in numeric order, the structure of the configuration has led to the following conventions in usage: diff --git a/fontconfig/configure.ac b/fontconfig/configure.ac index 791937226..0f129db0d 100644 --- a/fontconfig/configure.ac +++ b/fontconfig/configure.ac @@ -33,7 +33,7 @@ dnl This is the package version number, not the shared library dnl version. This same version number must appear in fontconfig/fontconfig.h dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's dnl not possible to extract the version number here from fontconfig.h -AC_INIT([fontconfig], [2.10.92], [https://bugs.freedesktop.org/enger_bug.cgi?product=fontconfig]) +AC_INIT([fontconfig], [2.10.93], [https://bugs.freedesktop.org/enger_bug.cgi?product=fontconfig]) AM_INIT_AUTOMAKE([1.11 parallel-tests dist-bzip2]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) diff --git a/fontconfig/doc/fontconfig-devel.sgml b/fontconfig/doc/fontconfig-devel.sgml index 05c5c0928..a7b853021 100644 --- a/fontconfig/doc/fontconfig-devel.sgml +++ b/fontconfig/doc/fontconfig-devel.sgml @@ -196,6 +196,9 @@ convenience for the application's rendering mechanism. default value of familylang, 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. + postscriptname FC_POSTSCRIPT_NAME String Font name in PostScript </programlisting> </sect2> </sect1> diff --git a/fontconfig/fontconfig/fontconfig.h b/fontconfig/fontconfig/fontconfig.h index 361ca4f9e..422187b3c 100644 --- a/fontconfig/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig/fontconfig.h @@ -52,7 +52,7 @@ typedef int FcBool; #define FC_MAJOR 2 #define FC_MINOR 10 -#define FC_REVISION 92 +#define FC_REVISION 93 #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION)) diff --git a/fontconfig/src/fcatomic.h b/fontconfig/src/fcatomic.h index a76431139..362e52164 100644 --- a/fontconfig/src/fcatomic.h +++ b/fontconfig/src/fcatomic.h @@ -70,13 +70,25 @@ typedef LONG fc_atomic_int_t; #elif !defined(FC_NO_MT) && defined(__APPLE__) #include <libkern/OSAtomic.h> +#ifdef __MAC_OS_X_MIN_REQUIRED +#include <AvailabilityMacros.h> +#elif defined(__IPHONE_OS_MIN_REQUIRED) +#include <Availability.h> +#endif typedef int fc_atomic_int_t; #define fc_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V)) #define fc_atomic_ptr_get(P) (OSMemoryBarrier (), (void *) *(P)) +#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100) #define fc_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P)) - +#else +#if __ppc64__ || __x86_64__ +#define fc_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t*) (P)) +#else +#define fc_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t*) (P)) +#endif +#endif #elif !defined(FC_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c index 7da50b50f..fcdf73efe 100644 --- a/fontconfig/src/fccfg.c +++ b/fontconfig/src/fccfg.c @@ -2211,57 +2211,13 @@ FcConfigGlobAdd (FcConfig *config, } static FcBool -FcConfigGlobMatch (const FcChar8 *glob, - const FcChar8 *string) -{ - FcChar8 c; - - while ((c = *glob++)) - { - switch (c) { - case '*': - /* short circuit common case */ - if (!*glob) - return FcTrue; - /* short circuit another common case */ - if (strchr ((char *) glob, '*') == 0) - { - size_t l1, l2; - - l1 = strlen ((char *) string); - l2 = strlen ((char *) glob); - if (l1 < l2) - return FcFalse; - string += (l1 - l2); - } - while (*string) - { - if (FcConfigGlobMatch (glob, string)) - return FcTrue; - string++; - } - return FcFalse; - case '?': - if (*string++ == '\0') - return FcFalse; - break; - default: - if (*string++ != c) - return FcFalse; - break; - } - } - return *string == '\0'; -} - -static FcBool FcConfigGlobsMatch (const FcStrSet *globs, const FcChar8 *string) { int i; for (i = 0; i < globs->num; i++) - if (FcConfigGlobMatch (globs->strs[i], string)) + if (FcStrGlobMatch (globs->strs[i], string)) return FcTrue; return FcFalse; } diff --git a/fontconfig/src/fcfreetype.c b/fontconfig/src/fcfreetype.c index 8a037c059..02e85cb05 100644 --- a/fontconfig/src/fcfreetype.c +++ b/fontconfig/src/fcfreetype.c @@ -1104,7 +1104,10 @@ FcFreeTypeQueryFace (const FT_Face face, char psname[256]; const char *tmp; - FcChar8 *hashstr; + FcChar8 *hashstr = NULL; + char *fontdata = NULL; + FT_Error err; + FT_ULong len = 0, alen; pat = FcPatternCreate (); if (!pat) @@ -1662,12 +1665,36 @@ FcFreeTypeQueryFace (const FT_Face face, if (!FcPatternAddBool (pat, FC_DECORATIVE, decorative)) goto bail1; - hashstr = FcHashGetSHA256DigestFromFile (file); - if (!hashstr) - goto bail1; - if (!FcPatternAddString (pat, FC_HASH, hashstr)) - goto bail1; - free (hashstr); + err = FT_Load_Sfnt_Table (face, 0, 0, NULL, &len); + if (err == FT_Err_Ok) + { + alen = (len + 63) & ~63; + fontdata = malloc (alen); + if (!fontdata) + goto bail3; + err = FT_Load_Sfnt_Table (face, 0, 0, (FT_Byte *)fontdata, &len); + if (err != FT_Err_Ok) + goto bail3; + memset (&fontdata[len], 0, alen - len); + hashstr = FcHashGetSHA256DigestFromMemory (fontdata, len); + } + else if (err == FT_Err_Invalid_Face_Handle) + { + /* font may not support SFNT. falling back to + * read the font data from file directly + */ + hashstr = FcHashGetSHA256DigestFromFile (file); + } + else + { + goto bail3; + } + if (hashstr) + { + if (!FcPatternAddString (pat, FC_HASH, hashstr)) + goto bail1; + } +bail3: /* * Compute the unicode coverage for the font @@ -1756,6 +1783,10 @@ FcFreeTypeQueryFace (const FT_Face face, bail2: FcCharSetDestroy (cs); bail1: + if (hashstr) + free (hashstr); + if (fontdata) + free (fontdata); FcPatternDestroy (pat); bail0: return NULL; diff --git a/fontconfig/src/fchash.c b/fontconfig/src/fchash.c index 827b20f9f..92585a632 100644 --- a/fontconfig/src/fchash.c +++ b/fontconfig/src/fchash.c @@ -220,7 +220,7 @@ FcHashGetSHA256DigestFromFile (const FcChar8 *filename) ret = FcHashInitSHA256Digest (); if (!ret) - return NULL; + goto bail0; while (!feof (fp)) { @@ -261,5 +261,60 @@ FcHashGetSHA256DigestFromFile (const FcChar8 *filename) bail0: fclose (fp); + return NULL; } + +FcChar8 * +FcHashGetSHA256DigestFromMemory (const char *fontdata, + size_t length) +{ + char ibuf[64]; + FcChar32 *ret; + size_t i = 0; + + ret = FcHashInitSHA256Digest (); + if (!ret) + return NULL; + + while (i <= length) + { + if ((length - i) < 64) + { + long v; + size_t n; + + /* add a padding */ + n = length - i; + if (n > 0) + memcpy (ibuf, &fontdata[i], n); + memset (&ibuf[n], 0, 64 - n); + ibuf[n] = 0x80; + if ((64 - n) < 9) + { + /* process a block once */ + FcHashComputeSHA256Digest (ret, ibuf); + memset (ibuf, 0, 64); + } + /* set input size at the end */ + v = length * 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; + FcHashComputeSHA256Digest (ret, ibuf); + break; + } + else + { + FcHashComputeSHA256Digest (ret, &fontdata[i]); + } + i += 64; + } + + return FcHashSHA256ToString (ret); +} diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h index c45075ecc..65bf3330b 100644 --- a/fontconfig/src/fcint.h +++ b/fontconfig/src/fcint.h @@ -818,9 +818,14 @@ FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s); FcPrivate FcChar8 * FcHashGetSHA256Digest (const FcChar8 *input_strings, size_t len); + FcPrivate FcChar8 * FcHashGetSHA256DigestFromFile (const FcChar8 *filename); +FcPrivate FcChar8 * +FcHashGetSHA256DigestFromMemory (const char *fontdata, + size_t length); + /* fcinit.c */ FcPrivate FcConfig * FcInitLoadOwnConfig (FcConfig *config); @@ -1085,6 +1090,10 @@ FcPrivate int FcStrMatchIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims); FcPrivate FcBool +FcStrGlobMatch (const FcChar8 *glob, + const FcChar8 *string); + +FcPrivate FcBool FcStrUsesHome (const FcChar8 *s); FcPrivate FcChar8 * diff --git a/fontconfig/src/fcmatch.c b/fontconfig/src/fcmatch.c index 2d7b79840..10976d6e8 100644 --- a/fontconfig/src/fcmatch.c +++ b/fontconfig/src/fcmatch.c @@ -191,17 +191,26 @@ FcCompareSize (FcValue *value1, FcValue *value2) static double FcCompareFilename (FcValue *v1, FcValue *v2) { - const FcChar8 *s1 = FcValueString (v1), *s2 = FcValueString (v2); - if (FcStrCmp (s1, s2) == 0) - return 0.0; - else if (FcStrCmpIgnoreCase (s1, s2) == 0) - return 1.0; - else if (FcStrRegexCmp (s2, s1)) - return 2.0; - else if (FcStrRegexCmpIgnoreCase (s2, s1)) - return 3.0; - else - return 4.0; + const FcChar8 *s1 = FcValueString (v1), *s2 = FcValueString (v2); + if (FcStrCmp (s1, s2) == 0) + return 0.0; + else if (FcStrCmpIgnoreCase (s1, s2) == 0) + return 1.0; + else if (FcStrGlobMatch (s1, s2)) + return 2.0; + else + return 3.0; +} + +static double +FcCompareHash (FcValue *v1, FcValue *v2) +{ + const FcChar8 *s1 = FcValueString (v1), *s2 = FcValueString (v2); + + /* Do not match an empty string */ + if (!s1 || !s2 || !s1[0] || !s2[0]) + return 1.0; + return FcCompareString (v1, v2); } #define PRI_NULL(n) \ @@ -217,6 +226,7 @@ FcCompareFilename (FcValue *v1, FcValue *v2) #define PRI_FcCompareCharSet(n) PRI1(n) #define PRI_FcCompareLang(n) PRI1(n) #define PRI_FcComparePostScript(n) PRI1(n) +#define PRI_FcCompareHash(n) PRI1(n) #define FC_OBJECT(NAME, Type, Cmp) PRI_##Cmp(NAME) diff --git a/fontconfig/src/fcname.c b/fontconfig/src/fcname.c index 6dd4d4948..a52534548 100644 --- a/fontconfig/src/fcname.c +++ b/fontconfig/src/fcname.c @@ -318,6 +318,12 @@ FcNameFindNext (const FcChar8 *cur, const char *delim, FcChar8 *save, FcChar8 *l while ((c = *cur)) { + if (!isspace (c)) + break; + ++cur; + } + while ((c = *cur)) + { if (c == '\\') { ++cur; diff --git a/fontconfig/src/fcobjs.h b/fontconfig/src/fcobjs.h index b7354012d..682fe6ad3 100644 --- a/fontconfig/src/fcobjs.h +++ b/fontconfig/src/fcobjs.h @@ -43,6 +43,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, FcCompareString) +FC_OBJECT (HASH, FcTypeString, FcCompareHash) FC_OBJECT (POSTSCRIPT_NAME, FcTypeString, FcComparePostScript) /* ^-------------- Add new objects here. */ diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c index 339a3465d..3a32031a2 100644 --- a/fontconfig/src/fcstr.c +++ b/fontconfig/src/fcstr.c @@ -459,6 +459,50 @@ FcStrMatchIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcCha return w1.src - s1 - 1; } +FcBool +FcStrGlobMatch (const FcChar8 *glob, + const FcChar8 *string) +{ + FcChar8 c; + + while ((c = *glob++)) + { + switch (c) { + case '*': + /* short circuit common case */ + if (!*glob) + return FcTrue; + /* short circuit another common case */ + if (strchr ((char *) glob, '*') == 0) + { + size_t l1, l2; + + l1 = strlen ((char *) string); + l2 = strlen ((char *) glob); + if (l1 < l2) + return FcFalse; + string += (l1 - l2); + } + while (*string) + { + if (FcStrGlobMatch (glob, string)) + return FcTrue; + string++; + } + return FcFalse; + case '?': + if (*string++ == '\0') + return FcFalse; + break; + default: + if (*string++ != c) + return FcFalse; + break; + } + } + return *string == '\0'; +} + const FcChar8 * FcStrStrIgnoreCase (const FcChar8 *s1, const FcChar8 *s2) { |