for (set = FcSetSystem; set <= FcSetApplication; set++)
config->fonts[set] = 0;
- config->caches = NULL;
-
config->rescanTime = time(0);
config->rescanInterval = 30;
FcConfigDestroy (FcConfig *config)
{
FcSetName set;
- FcCacheList *cl, *cl_next;
if (config == _fcConfig)
_fcConfig = 0;
if (config->fonts[set])
FcFontSetDestroy (config->fonts[set]);
- for (cl = config->caches; cl; cl = cl_next)
- {
- cl_next = cl->next;
- FcDirCacheUnload (cl->cache);
- free (cl);
- }
-
free (config);
FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig));
}
FcBool
FcConfigAddCache (FcConfig *config, FcCache *cache)
{
- FcCacheList *cl = malloc (sizeof (FcCacheList));
FcFontSet *fs;
intptr_t *dirs;
int i;
- /*
- * Add to cache list
- */
- if (!cl)
- return FcFalse;
- cl->cache = cache;
- cl->next = config->caches;
- config->caches = cl;
-
/*
* Add fonts
*/
fs = FcCacheSet (cache);
if (fs)
{
+ int nref = 0;
+
for (i = 0; i < fs->nfont; i++)
{
FcPattern *font = FcFontSetFont (fs, i);
if (!FcConfigAcceptFont (config, font))
continue;
+ nref++;
FcFontSetAdd (config->fonts[FcSetSystem], font);
}
+ FcDirCacheReference (cache, nref);
}
/*
if (!cache)
continue;
FcConfigAddCache (config, cache);
+ FcDirCacheUnload (cache);
}
FcStrListDone (dirlist);