From a9698bed6553c12d397593292ee9e81054244e85 Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Fri, 23 Sep 2005 04:09:37 +0000 Subject: [PATCH] Update documentation -- fc-cache's man page now says that you need to run fc-cache once per cached architecture; add some documentation to the FcCache structure. Make fc-cache write out fonts.cache-2 files for directories with no fonts (i.e. only subdirectories). --- fc-cache/fc-cache.sgml | 7 +++++++ src/fccache.c | 13 ++++++++----- src/fcint.h | 8 ++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/fc-cache/fc-cache.sgml b/fc-cache/fc-cache.sgml index acc31ec..72df17e 100644 --- a/fc-cache/fc-cache.sgml +++ b/fc-cache/fc-cache.sgml @@ -88,6 +88,13 @@ manpage.1: manpage.sgml This cache is used to speed up application startup when using the fontconfig library. + Note that &dhpackage; must be executed + once per architecture to generate font information customized + for that architecture. On a subsequent run, + &dhpackage; will augment the cache + information files with the information for the new + architecture. + OPTIONS diff --git a/src/fccache.c b/src/fccache.c index 31630f1..1121f31 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -744,14 +744,14 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir) current_dir_block = FcDirCacheProduce (set, &metadata); - if (!metadata.count) + if (!metadata.count && !dirs->size) { unlink ((char *)cache_file); free (cache_file); return FcTrue; } - if (!current_dir_block) + if (metadata.count && !current_dir_block) goto bail; if (FcDebug () & FC_DBG_CACHE) @@ -788,9 +788,12 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir) FcCacheWriteString (fd, ""); write (fd, &metadata, sizeof(FcCache)); - lseek (fd, FcCacheNextOffset (lseek(fd, 0, SEEK_END)), SEEK_SET); - write (fd, current_dir_block, metadata.count); - free (current_dir_block); + if (metadata.count) + { + lseek (fd, FcCacheNextOffset (lseek(fd, 0, SEEK_END)), SEEK_SET); + write (fd, current_dir_block, metadata.count); + free (current_dir_block); + } /* this actually serves to pad out the cache file, if needed */ if (ftruncate (fd, current_arch_start + truncate_to) == -1) diff --git a/src/fcint.h b/src/fcint.h index 4165011..834f085 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -251,10 +251,10 @@ typedef struct _FcCache { int pattern_count; /* number of FcPatterns */ int patternelt_count; /* number of FcPatternElts */ int valuelist_count; /* number of FcValueLists */ - int str_count; /* number of FcStrs */ - int langset_count; - int charset_count; - int charset_numbers_count; + int str_count; /* size of strings appearing as FcValues */ + int langset_count; /* number of FcLangSets */ + int charset_count; /* number of FcCharSets */ + int charset_numbers_count; int charset_leaf_count; int charset_leaf_idx_count; } FcCache; -- 2.39.5