Warn if <name target="font"> appears in <match target="pattern">

This commit is contained in:
Behdad Esfahbod 2012-12-31 20:11:12 -06:00
parent 424cfa1684
commit 209750a4e0
1 changed files with 15 additions and 6 deletions

View File

@ -164,7 +164,7 @@ FcConfigUptoDate (FcConfig *config)
(font_time.set && (font_time.time - now) > 0)) (font_time.set && (font_time.time - now) > 0))
{ {
fprintf (stderr, fprintf (stderr,
"Fontconfig warning: Directory/file mtime in the future. New fonts may not be detected\n"); "Fontconfig warning: Directory/file mtime in the future. New fonts may not be detected.\n");
config->rescanTime = now; config->rescanTime = now;
return FcTrue; return FcTrue;
} }
@ -870,7 +870,6 @@ static FcValue
FcConfigEvaluate (FcPattern *p, FcPattern *p_pat, FcMatchKind kind, FcExpr *e) FcConfigEvaluate (FcPattern *p, FcPattern *p_pat, FcMatchKind kind, FcExpr *e)
{ {
FcValue v, vl, vr; FcValue v, vl, vr;
FcResult r;
FcMatrix *m; FcMatrix *m;
FcChar8 *str; FcChar8 *str;
FcOp op = FC_OP_GET_OP (e->op); FcOp op = FC_OP_GET_OP (e->op);
@ -928,11 +927,21 @@ FcConfigEvaluate (FcPattern *p, FcPattern *p_pat, FcMatchKind kind, FcExpr *e)
break; break;
case FcOpField: case FcOpField:
if (kind == FcMatchFont && e->u.name.kind == FcMatchPattern) if (kind == FcMatchFont && e->u.name.kind == FcMatchPattern)
r = FcPatternObjectGet (p_pat, e->u.name.object, 0, &v); {
else if (FcResultMatch != FcPatternObjectGet (p_pat, e->u.name.object, 0, &v))
r = FcPatternObjectGet (p, e->u.name.object, 0, &v); v.type = FcTypeVoid;
if (r != FcResultMatch) }
else if (kind == FcMatchPattern && e->u.name.kind == FcMatchFont)
{
fprintf (stderr,
"Fontconfig warning: <name> tag has target=\"font\" in a <match target=\"pattern\">.\n");
v.type = FcTypeVoid; v.type = FcTypeVoid;
}
else
{
if (FcResultMatch != FcPatternObjectGet (p, e->u.name.object, 0, &v))
v.type = FcTypeVoid;
}
v = FcValueSave (v); v = FcValueSave (v);
break; break;
case FcOpConst: case FcOpConst: