[Fontconfig] separate cache file from directories?

Han-Wen Nienhuys hanwen at xs4all.nl
Fri Jun 17 22:26:47 EST 2005


Keith Packard wrote:
>>The problem is that MacOS ships with a bunch of fonts in 
>>/System/Library/Fonts. Whenever our application starts
>>it scans this directory. This takes several minutes due to the oriental 
>>fonts. fc-cache cannot cache this directory, since it is not writable by 
>>ordinary users.
> 
> 
> fontconfig should be caching information about those fonts in
> ~/.fonts.cache-1.

For some reason, this is not happening on my MacOS X box. Any clue why?

[debugging..]

It seems that fontconfig defaults to the compile time paths, which is 
why my local.conf isn't seen. From the source code, I can see I can 
override this with the

   FONTCONFIG_PATH

environment variable. Could this information be added to the 
documentation?  This is crucial for Windows and macos applications, 
since they need to be relocatable. I now notice that FONTCONFIG_FILE and 
FC_DEBUG are not documented either, BTW.

Also, it would be nice if there a way to detect whether the cache 
rebuild is happening. Right now we can't give the user any feedback on 
what is happening, and why the startup is taking so long. Of course, for 
the first run, we can kludge around it by detecting whether 
.fonts.cache-1 exists.

> One obvious kludge would be to construct a parallel hierarchy in some
> writable partition and place the cache files there, similar to how CVS
> manages out-of-tree lock files.
> 
> I think this would be fairly easy -- just prefixing the cache file names
> with a path string.

Indeed. Then .fonts.cache-1 would become a directory tree instead of a 
single file.

-- 
  Han-Wen Nienhuys - hanwen at xs4all.nl - http://www.xs4all.nl/~hanwen



More information about the Fontconfig mailing list