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).
This commit is contained in:
Patrick Lam 2005-09-23 04:09:37 +00:00
parent e3ff8a4ea6
commit a9698bed65
3 changed files with 19 additions and 9 deletions

View File

@ -88,6 +88,13 @@ manpage.1: manpage.sgml
This cache is used to speed up application startup when using This cache is used to speed up application startup when using
the fontconfig library.</para> the fontconfig library.</para>
<para>Note that <command>&dhpackage;</command> must be executed
once per architecture to generate font information customized
for that architecture. On a subsequent run,
<command>&dhpackage;</command> will augment the cache
information files with the information for the new
architecture. </para>
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>OPTIONS</title> <title>OPTIONS</title>

View File

@ -744,14 +744,14 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
current_dir_block = FcDirCacheProduce (set, &metadata); current_dir_block = FcDirCacheProduce (set, &metadata);
if (!metadata.count) if (!metadata.count && !dirs->size)
{ {
unlink ((char *)cache_file); unlink ((char *)cache_file);
free (cache_file); free (cache_file);
return FcTrue; return FcTrue;
} }
if (!current_dir_block) if (metadata.count && !current_dir_block)
goto bail; goto bail;
if (FcDebug () & FC_DBG_CACHE) if (FcDebug () & FC_DBG_CACHE)
@ -788,9 +788,12 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
FcCacheWriteString (fd, ""); FcCacheWriteString (fd, "");
write (fd, &metadata, sizeof(FcCache)); write (fd, &metadata, sizeof(FcCache));
if (metadata.count)
{
lseek (fd, FcCacheNextOffset (lseek(fd, 0, SEEK_END)), SEEK_SET); lseek (fd, FcCacheNextOffset (lseek(fd, 0, SEEK_END)), SEEK_SET);
write (fd, current_dir_block, metadata.count); write (fd, current_dir_block, metadata.count);
free (current_dir_block); free (current_dir_block);
}
/* this actually serves to pad out the cache file, if needed */ /* this actually serves to pad out the cache file, if needed */
if (ftruncate (fd, current_arch_start + truncate_to) == -1) if (ftruncate (fd, current_arch_start + truncate_to) == -1)

View File

@ -251,9 +251,9 @@ typedef struct _FcCache {
int pattern_count; /* number of FcPatterns */ int pattern_count; /* number of FcPatterns */
int patternelt_count; /* number of FcPatternElts */ int patternelt_count; /* number of FcPatternElts */
int valuelist_count; /* number of FcValueLists */ int valuelist_count; /* number of FcValueLists */
int str_count; /* number of FcStrs */ int str_count; /* size of strings appearing as FcValues */
int langset_count; int langset_count; /* number of FcLangSets */
int charset_count; int charset_count; /* number of FcCharSets */
int charset_numbers_count; int charset_numbers_count;
int charset_leaf_count; int charset_leaf_count;
int charset_leaf_idx_count; int charset_leaf_idx_count;