[Fontconfig] blacklisting doesn't work

Patrick Lam plam at MIT.EDU
Sun Oct 23 06:26:56 EST 2005


Keith Packard wrote:
> It doesn't matter -- each global cache entry has a private timestamp
> which is compared only against the font file timestamp. The directories
> which aren't in the per-dir cache system are *always scanned* and
> compared with global cache entries. This means that any changes in the
> configuration will automatically get reflected in the cache file.

There seems to be some confusion about the behaviour of the cache.
Here's some documentation, and a question.

fontconfig's inputs are a config file and a set of fonts.  It then
generates FcPatterns for the fonts present and specified in the config
files.

To speed up the generation of FcPatterns, fontconfig generates two
caches: a global cache and a per-directory cache.  The per-directory
cache stores serialized versions of FcPatterns for all of the fonts in
a directory; when a per-directory cache is deserialized, then only
fonts which are accepted by the configuration are added to the
configuration's FontSet.  Since a separate program creates the
per-directory caches, the overhead of loading all fonts here is not
excessive.

We have two choices for the global cache.  Either it can contain all
of the fonts in the directory cache, or it can contain only the
accepted fonts.  If the global cache contains only accepted fonts, we
have a dependency between the global cache and the configuration, but
loading the caches is much simpler (and probably faster): fontconfig
just compares the directory last-modified time with the global cache
last-modified time; if the directory is older than the cache,
fontconfig then reads in the cached information for a directory
(without further processing).  On the other hand, if the global cache
contains all fonts, then the invocation of fontconfig which creates or
updates a global cache is responsible for loading all fonts in a
directory, writing that to disk, and selecting only accepted fonts for
subsequent use.  The load-cache-from-disk process also would need to
select accepted fonts in that case.

Currently, the global cache code stores only accepted fonts, but does
not record a dependency of the cache information on the configuration
information.

pat



More information about the Fontconfig mailing list