config->substPattern = 0;
config->substFont = 0;
+ config->substScan = 0;
config->maxObjects = 0;
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;
FcSubstDestroy (config->substPattern);
FcSubstDestroy (config->substFont);
+ FcSubstDestroy (config->substScan);
for (set = FcSetSystem; set <= FcSetApplication; set++)
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);
FcTest *t;
int num;
+ switch (kind) {
+ case FcMatchPattern:
+ prev = &config->substPattern;
+ break;
+ case FcMatchFont:
+ prev = &config->substFont;
+ break;
+ case FcMatchScan:
+ prev = &config->substScan;
+ break;
+ default:
+ return FcFalse;
+ }
subst = (FcSubst *) malloc (sizeof (FcSubst));
if (!subst)
return FcFalse;
FcMemAlloc (FC_MEM_SUBST, sizeof (FcSubst));
- if (kind == FcMatchPattern)
- prev = &config->substPattern;
- else
- prev = &config->substFont;
for (; *prev; prev = &(*prev)->next);
*prev = subst;
subst->next = 0;
return FcFalse;
}
+ switch (kind) {
+ case FcMatchPattern:
+ s = config->substPattern;
+ break;
+ case FcMatchFont:
+ s = config->substFont;
+ break;
+ case FcMatchScan:
+ s = config->substScan;
+ break;
+ default:
+ return FcFalse;
+ }
+
st = (FcSubState *) malloc (config->maxObjects * sizeof (FcSubState));
if (!st && config->maxObjects)
return FcFalse;
printf ("FcConfigSubstitute ");
FcPatternPrint (p);
}
- if (kind == FcMatchPattern)
- s = config->substPattern;
- else
- s = config->substFont;
for (; s; s = s->next)
{
/*
return FcFalse;
return FcTrue;
}
+#define __fccfg__
+#include "fcaliastail.h"
+#undef __fccfg__