From 75abdaf5c8e8b14c3e9e94ff5c563091594a32cf Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 9 Jun 2014 21:53:01 -0400 Subject: [PATCH] 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). --- doc/fontconfig-devel.sgml | 2 +- fontconfig/fontconfig.h | 2 +- src/fcfreetype.c | 2 ++ src/fcobjs.h | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) 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 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. */