[Fontconfig] Lazy caching

Raimund Steger rs at mytum.de
Fri Mar 11 22:44:35 UTC 2016

On Thu, 10 Mar 2016 15:24:48 -0800
Behdad Esfahbod <behdad at behdad.org> wrote:

> I've started to convince myself that fontconfig should NOT by default cache
> the charset info of all fonts, and do so only lazily.  This will solve most
> of the "caching is slow" issues...  Needless to say, that's better done in

I have mixed feelings about this.

First of all, the "traditional" way to use fontconfig (with a prebuilt cache that is aligned with the system font directory) is probably *not* the main source of concern IF the stat issue is fixed (the discussion in January). Conversely, I'm guessing if 2.12 ships with that regression this might be the main source of new complaints, like bug 94427. But this is really independent of any charset scanning.

So what we would be trying to do is make fontconfig more suitable for systems where nobody maintains a proper cache. This might involve embedded scenarios where a custom (not up to standards) packaging scheme is used, Win32 of course, and maybe MacOS.

I know that in some places the "discussion" has reached a point where some people will reject any build configuration that results in fontconfig being linked in with religious fervor. We'd probably have to rename the project in order to get a second chance with these guys. Even if most of the bad reputation came from 2.11 setups where FC_HASH was still there and %APPDATA% wasn't used for the cache direcory.

With all that said, I think I agree that matches where the following is true:

(1) no charset in the pattern
(2) strong family in the pattern, so that it overrules 'lang' and 'spacing'

could benefit from an implementation where charset isn't computed right away. On Windows, this might even be true for most use cases of fontconfig.

On Unix not so much, a single <acceptfont> rule with 'spacing' in it, or an app like Firefox that executes FcFontSort on every startup, could ruin it all.

The question is, is it all worth the extra complexity.


Worringer Str 31 Duesseldorf 40211 DE  home: rs at mytum.de
+49-179-2981632 icq 16845346           work: rs at interface-ag.de

More information about the Fontconfig mailing list