return 0;
}
-typedef struct _FcFileTime {
- time_t time;
- FcBool set;
-} FcFileTime;
-
static FcFileTime
FcConfigNewestFile (FcStrSet *files)
{
return newest;
}
+FcFileTime
+FcConfigModifiedTime (FcConfig *config)
+{
+ if (!config)
+ {
+ FcFileTime v = { 0, FcFalse };
+ config = FcConfigGetCurrent ();
+ if (!config)
+ return v;
+ }
+ return FcConfigNewestFile (config->configFiles);
+}
+
FcBool
FcConfigUptoDate (FcConfig *config)
{
goto bail2;
if (config->cache)
- FcGlobalCacheLoad (cache, oldDirs, config->cache);
+ FcGlobalCacheLoad (cache, oldDirs, config->cache, config);
cached_fonts = FcCacheRead(config, cache);
if (!cached_fonts)
for (i = 0; i < cached_fonts->nfont; i++)
{
- if (FcConfigAcceptFont (config, cached_fonts->fonts[i]))
+ FcChar8 *cfn;
+ FcPatternGetString (cached_fonts->fonts[i], FC_FILE, 0, &cfn);
+
+ if (FcConfigAcceptFont (config, cached_fonts->fonts[i]) &&
+ (cfn && FcConfigAcceptFilename (config, cfn)))
FcFontSetAdd (fonts, cached_fonts->fonts[i]);
cached_fonts->fonts[i] = 0; /* prevent free in FcFontSetDestroy */
FcFontSetPrint (fonts);
if (config->cache)
- FcGlobalCacheSave (cache, config->cache);
+ FcGlobalCacheSave (cache, config->cache, config);
FcGlobalCacheDestroy (cache);
FcStrSetDestroy (oldDirs);
return FcStrSetAddFilename (config->fontDirs, d);
}
+const FcChar8 *
+FcConfigNormalizeFontDir (FcConfig *config,
+ const FcChar8 *d)
+{
+ /* If this is a bottleneck, we can cache the fontDir inodes. */
+ ino_t di;
+ dev_t dd;
+ int n;
+ struct stat s;
+
+ if (stat ((char *)d, &s) == -1)
+ return 0;
+ di = s.st_ino; dd = s.st_dev;
+
+ for (n = 0; n < config->fontDirs->num; n++)
+ {
+ if (stat ((char *)config->fontDirs->strs[n], &s) == -1)
+ continue;
+ if (di == s.st_ino && dd == s.st_dev)
+ return config->fontDirs->strs[n];
+ }
+ return 0;
+}
+
FcBool
FcConfigAddDir (FcConfig *config,
const FcChar8 *d)
r = FcPatternGet (p, e->u.field, 0, &v);
if (r != FcResultMatch)
v.type = FcTypeVoid;
+ v = FcValueSave (v);
break;
case FcOpConst:
if (FcNameConstant (e->u.constant, &v.u.i))
FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
{
FcValueList *l;
- FcValueListPtr lp;
if (!e)
return 0;
l->next = FcValueListPtrCreateDynamic(0);
}
l->binding = binding;
- lp = FcValueListPtrCreateDynamic(l);
- while (FcValueListPtrU(lp) && FcValueListPtrU(lp)->value.type == FcTypeVoid)
+ if (l->value.type == FcTypeVoid)
{
- FcValueListPtr next = FcValueListPtrU(lp)->next;
+ FcValueList *next = FcValueListPtrU(l->next);
- if (lp.bank == FC_BANK_DYNAMIC)
- {
- FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
- free (l);
- }
- lp = next;
+ FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
+ free (l);
+ l = next;
}
+
return l;
}