Bug 18195 - Font cache never reused on win32
Summary: Font cache never reused on win32
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.6
Hardware: x86 (IA32) Windows (All)
: medium major
Assignee: Keith Packard
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-23 19:30 UTC by Tim Evans
Modified: 2009-06-24 12:35 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Tim Evans 2008-10-23 19:30:59 UTC
At least on Vista, and when linked against the newest version of Microsoft's C library (MSVCR90.dll) fontconfig never reuses the saved cache file.  It always thinks it's invalid because the cache timestamp doesn't match the directory.  The problem appears to be in the "FcStat" function, which is returning an mtime value for C:\WINDOWS\Fonts that is one hour behind the normal "stat" mtime.  Changing all uses of FcStat to normal stat fixed the problem for me.

I wouldn't be surprised if this is related to daylight savings; I'm in New Zealand and we have daylight savings active at the moment.

If it is expected that FcStat and stat results will be different then the problem is that the two are mixed when determining if a cache file is up to date.

This is actually a rather nasty problem, because even on my fast machine building the font cache for all the fonts that Vista ships with is a very slow process.  Rebuilding it every time my program is run is painful.
Comment 1 Han-Wen Nienhuys 2008-11-15 15:37:09 UTC
LilyPond is also affected by this,

http://lists.gnu.org/archive/html/lilypond-user/2008-11/msg00397.html
Comment 2 Behdad Esfahbod 2008-12-28 01:01:16 UTC
Fixed in my tree:
Created commit 711b953: [fccache] Consistently use FcStat() over stat() (bug #18195)
 1 files changed, 1 insertions(+), 1 deletions(-)

Tim, can you see if this patch fixes it for you:

diff --git a/src/fccache.c b/src/fccache.c
index 241ebd0..c7a2dcd 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -520,7 +520,7 @@ FcCacheTimeValid (FcCache *cache, struct stat *dir_stat)
 
     if (!dir_stat)
     {
-       if (stat ((const char *) FcCacheDir (cache), &dir_static) < 0)
+       if (FcStat ((const char *) FcCacheDir (cache), &dir_static) < 0)
            return FcFalse;
        dir_stat = &dir_static;
     }
Comment 3 Behdad Esfahbod 2009-06-24 12:35:34 UTC
I believe I've fixed this in 2.7.0.  Please reopen otherwise.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.