[XeTeX] Xetex TexLife and fc-cache

Jonathan Kew jfkthame at googlemail.com
Wed Aug 10 11:19:17 CEST 2011

On 10 Aug 2011, at 09:03, Nicolás Hatcher wrote:

> Hi All (again):
> It seems I was guessing too much. Perhaps my problem is not fc-cache.
> What happens is that with any new day the first xelatex run is extremely slow.
> Could be 5 minutes before pass the line
> This is XeTeX, Version ...
> I am doing a system that produces pdf documents on demand from a website. I cannot ask the user to wait "sometimes" 5 minutes.
> I know is not fc-cache because I substituted it with a dummy file and the problem is still there.
> What does XeTeX before launching?
> Any pointers to the source code so I can investigate myself?
> Would the same problem arise on MiKTeX?
> Again, thanks for your help in advance,
> Nicolás

My guess is that the fontconfig library (use by xetex) is updating its font cache file(s) - the same operation as fc-cache would do, if you ran it manually, but I believe the library does it automatically if it notices that the available fonts may have changed.

Normally, I'd expect this to happen if you add or remove fonts from your system; the first run after such a change will typically show a delay while the cache is rebuilt, unless you manually used fc-cache to refresh it first.

In your case, unless you are actually modifying your font collection daily, I wonder if some other periodic process (backup? virus-scan? etc) is touching the Fonts folder or font files in such a way that fontconfig thinks they may have changed - perhaps it monitors the last-modified time of the fonts directory, for example.

If you can determine what periodic task is triggering this, maybe (if that task is unavoidable) you could configure things so that fc-cache gets run afterwards; this should (I think) "prime" the cache so that xetex won't need to do its own rebuild on the next run.

(Incidentally, 5 minutes seems an EXTREMELY long time, unless you have many, many thousands of fonts installed. I wonder if something such as an antivirus product is hurting performance here, e.g. by stepping in and checking every file access that happens when the fonts folder is scanned. Or maybe you have things configured - perhaps via poor texmf.cnf or OSFONTDIR settings - such that huge directory trees are being unnecessarily scanned for fonts.)


More information about the XeTeX mailing list