]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccfg.c
Reinstate the old global cache code. For the forseeable future, it's
[fontconfig.git] / src / fccfg.c
index aaa05f56b47341ca34a3fb07eb0faaa7c1778f5f..4d2e0243a31ccb9fb42de7f6d9beb4be1b14e304 100644 (file)
@@ -252,24 +252,18 @@ FcConfigBuildFonts (FcConfig *config)
     FcStrList      *list;
     FcChar8        *dir;
 
-#if 0
-    if (config->cache)
-       FcGlobalCacheLoad (cache, config->cache);
-#endif
-    if (config->fonts[FcSetSystem])
-       return FcTrue;
-
     fonts = FcFontSetCreate ();
     if (!fonts)
        goto bail0;
-
-#if 0
+    
     cache = FcGlobalCacheCreate ();
     if (!cache)
        goto bail1;
-#endif
 
-    cached_fonts = FcCacheRead(config);
+    if (config->cache)
+       FcGlobalCacheLoad (cache, config->cache);
+
+    cached_fonts = FcCacheRead(config, cache);
     if (!cached_fonts)
     {
        list = FcConfigGetFontDirs (config);
@@ -294,18 +288,19 @@ FcConfigBuildFonts (FcConfig *config)
        {
            if (FcConfigAcceptFont (config, cached_fonts->fonts[i]))
                FcFontSetAdd (fonts, cached_fonts->fonts[i]);
+
+           cached_fonts->fonts[i] = 0; /* prevent free in FcFontSetDestroy */
        }
+       cached_fonts->nfont = 0;
        FcFontSetDestroy (cached_fonts);
     }
     
     if (FcDebug () & FC_DBG_FONTSET)
        FcFontSetPrint (fonts);
 
-#if 0
     if (config->cache)
        FcGlobalCacheSave (cache, config->cache);
     FcGlobalCacheDestroy (cache);
-#endif
 
     FcConfigSetFonts (config, fonts, FcSetSystem);