doc/fontconfig-devel.sgml | 2 fc-lang/ko.orth | 1 fontconfig/fontconfig.h | 2 src/Makefile.am | 1 src/fcfreetype.c | 49 ----------- src/fchash.c | 189 ---------------------------------------------- src/fcint.h | 19 ---- src/fcobjs.h | 4 8 files changed, 4 insertions(+), 263 deletions(-) New commits: commit 8f62ccaa962b13781d7916d4d1c061993b991e69 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Jun 9 22:00:25 2014 -0400 Remove unused FcHash code now that FC_HASH is deprecated diff --git a/src/Makefile.am b/src/Makefile.am index be20eba..c1991b2 100644 --- a/src/Makefile.am +++ b/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/src/fcfreetype.c b/src/fcfreetype.c index 464bc00..baf13e5 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1697,57 +1697,6 @@ FcFreeTypeQueryFace (const FT_Face face, goto bail1; -#if 0 - /* - * 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); - } - } -#endif - - /* * Compute the unicode coverage for the font */ diff --git a/src/fchash.c b/src/fchash.c deleted file mode 100644 index 1526cfd..0000000 --- a/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/src/fcint.h b/src/fcint.h index a1b147f..6871fdc 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -871,25 +871,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); commit 75abdaf5c8e8b14c3e9e94ff5c563091594a32cf Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Jun 9 21:53:01 2014 -0400 Deprecate FC_HASH and don't compute it It was added without proper measurement and a fuzzy possible use-case (font servers) in mind, but reality check shows that this significantly slows down caching. As such, deprecate it and do NOT compute hash during caching. Makes caching two to three times faster (ignoring the 2 second delay in fc-cache). diff --git a/doc/fontconfig-devel.sgml b/doc/fontconfig-devel.sgml index e2cb1c2..2b1122f 100644 --- a/doc/fontconfig-devel.sgml +++ b/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/fontconfig.h b/fontconfig/fontconfig.h index 069cb60..8575cc4 100644 --- a/fontconfig/fontconfig.h +++ b/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/src/fcfreetype.c b/src/fcfreetype.c index 3dd865a..464bc00 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1697,6 +1697,7 @@ FcFreeTypeQueryFace (const FT_Face face, goto bail1; +#if 0 /* * Compute hash digest for the font */ @@ -1744,6 +1745,7 @@ FcFreeTypeQueryFace (const FT_Face face, free (hashstr); } } +#endif /* diff --git a/src/fcobjs.h b/src/fcobjs.h index 72e71f9..dc3d834 100644 --- a/src/fcobjs.h +++ b/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. */ commit cd9631d83e51bab95413a8aa0e8ecc68f3e3a0fc Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Thu Jun 12 17:01:07 2014 -0400 [ko.orth] Remove U+3164 HANGUL FILLER Better not to reject a font just over that. Note that we do NOT list U+115F and U+1160 either. diff --git a/fc-lang/ko.orth b/fc-lang/ko.orth index 39114a5..4bb52c6 100644 --- a/fc-lang/ko.orth +++ b/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
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig