+Thu Aug 22 11:36:18 PDT 2002 keithp
+
+ + Add "contains" and "not_contains" operators and elements to
+ font configuration
+
+ + Changed semantics of eq operator for LangSets to check for
+ FcLangEqual so that any match will do
+
+ + FcFontList was using FcConfigCompareValue (...FcOpEqual) instead
+ of FcValueEqual to check for identical values when inserting into
+ the results. This broke when the above semantic change was made,
+ now it uses FcValueEqual which is "more correct" in any case.
+
Thu Aug 22 00:32:29 PDT 2002 keithp
+ Reimplement FC_LANG as new datatype. Lists of strings
<!ENTITY % expr 'int|double|string|matrix|bool|charset
|name|const
- |or|and|eq|not_eq|less|less_eq|more|more_eq
+ |or|and|eq|not_eq|less|less_eq|more|more_eq|contains|not_contains
|plus|minus|times|divide|not|if'>
<!--
qual (any|all|first|not_first) "any"
name CDATA #REQUIRED
target (pattern|font|default) "default"
- compare (eq|not_eq|less|less_eq|more|more_eq) "eq">
+ compare (eq|not_eq|less|less_eq|more|more_eq|contains|not_contains) "eq">
<!--
Edit a field in a pattern
<!ELEMENT less_eq ((%expr;), (%expr;))>
<!ELEMENT more ((%expr;), (%expr;))>
<!ELEMENT more_eq ((%expr;), (%expr;))>
+<!ELEMENT contains ((%expr;), (%expr;))>
+<!ELEMENT not_contains ((%expr;), (%expr;))>
<!ELEMENT plus (%expr;)*>
<!ELEMENT minus (%expr;)*>
<!ELEMENT times (%expr;)*>
/*
- * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.20 2002/08/19 19:32:05 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.21 2002/08/22 07:36:44 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
case FcOpContains:
ret = m.u.d == v.u.d;
break;
- case FcOpNotEqual:
+ case FcOpNotEqual:
+ case FcOpNotContains:
ret = m.u.d != v.u.d;
break;
case FcOpLess:
case FcOpContains:
ret = m.u.b == v.u.b;
break;
- case FcOpNotEqual:
+ case FcOpNotEqual:
+ case FcOpNotContains:
ret = m.u.b != v.u.b;
break;
default:
case FcOpContains:
ret = FcStrCmpIgnoreCase (m.u.s, v.u.s) == 0;
break;
- case FcOpNotEqual:
+ case FcOpNotEqual:
+ case FcOpNotContains:
ret = FcStrCmpIgnoreCase (m.u.s, v.u.s) != 0;
break;
default:
ret = FcMatrixEqual (m.u.m, v.u.m);
break;
case FcOpNotEqual:
+ case FcOpNotContains:
ret = !FcMatrixEqual (m.u.m, v.u.m);
break;
default:
/* m contains v if v is a subset of m */
ret = FcCharSetIsSubset (v.u.c, m.u.c);
break;
+ case FcOpNotContains:
+ /* m contains v if v is a subset of m */
+ ret = !FcCharSetIsSubset (v.u.c, m.u.c);
+ break;
case FcOpEqual:
ret = FcCharSetEqual (m.u.c, v.u.c);
break;
case FcOpContains:
ret = FcLangSetCompare (v.u.l, m.u.l) != FcLangDifferentLang;
break;
+ case FcOpNotContains:
+ ret = FcLangSetCompare (v.u.l, m.u.l) == FcLangDifferentLang;
+ break;
case FcOpEqual:
ret = FcLangSetEqual (v.u.l, m.u.l);
break;
case FcTypeFTFace:
switch (op) {
case FcOpEqual:
+ case FcOpContains:
ret = m.u.f == v.u.f;
break;
case FcOpNotEqual:
+ case FcOpNotContains:
ret = m.u.f != v.u.f;
break;
default:
}
else
{
- if (op == FcOpNotEqual)
+ if (op == FcOpNotEqual || op == FcOpNotContains)
ret = FcTrue;
}
return ret;
v.type = FcTypeVoid;
FcValueDestroy (vl);
break;
- case FcOpContains:
+ case FcOpEqual:
case FcOpNotEqual:
case FcOpLess:
case FcOpLessEqual:
case FcOpMore:
case FcOpMoreEqual:
+ case FcOpContains:
+ case FcOpNotContains:
vl = FcConfigEvaluate (p, e->u.tree.left);
vr = FcConfigEvaluate (p, e->u.tree.right);
v.type = FcTypeBool;
break;
case FcOpOr:
case FcOpAnd:
- case FcOpEqual:
case FcOpPlus:
case FcOpMinus:
case FcOpTimes:
case FcOpOr: printf ("Or"); break;
case FcOpAnd: printf ("And"); break;
case FcOpEqual: printf ("Equal"); break;
- case FcOpContains: printf ("Contains"); break;
case FcOpNotEqual: printf ("NotEqual"); break;
case FcOpLess: printf ("Less"); break;
case FcOpLessEqual: printf ("LessEqual"); break;
case FcOpMore: printf ("More"); break;
case FcOpMoreEqual: printf ("MoreEqual"); break;
+ case FcOpContains: printf ("Contains"); break;
+ case FcOpNotContains: printf ("NotContains"); break;
case FcOpPlus: printf ("Plus"); break;
case FcOpMinus: printf ("Minus"); break;
case FcOpTimes: printf ("Times"); break;
case FcOpOr:
case FcOpAnd:
case FcOpEqual:
- case FcOpContains:
case FcOpNotEqual:
case FcOpLess:
case FcOpLessEqual:
case FcOpMore:
case FcOpMoreEqual:
+ case FcOpContains:
+ case FcOpNotContains:
case FcOpPlus:
case FcOpMinus:
case FcOpTimes:
case FcOpOr: printf ("Or"); break;
case FcOpAnd: printf ("And"); break;
case FcOpEqual: printf ("Equal"); break;
- case FcOpContains: printf ("Contains"); break;
case FcOpNotEqual: printf ("NotEqual"); break;
case FcOpLess: printf ("Less"); break;
case FcOpLessEqual: printf ("LessEqual"); break;
case FcOpMore: printf ("More"); break;
case FcOpMoreEqual: printf ("MoreEqual"); break;
+ case FcOpContains: printf ("Contains"); break;
+ case FcOpNotContains: printf ("NotContains"); break;
case FcOpPlus: printf ("Plus"); break;
case FcOpMinus: printf ("Minus"); break;
case FcOpTimes: printf ("Times"); break;
/*
- * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.21 2002/07/31 01:36:37 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.24 2002/08/22 07:36:44 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
FcOpAssign, FcOpAssignReplace,
FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
FcOpQuest,
- FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual, FcOpContains,
+ FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual, FcOpContains, FcOpNotContains,
FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
FcOpNot, FcOpComma, FcOpInvalid
strs.num = 1;
strs.size = 1;
strs.strs = &str;
+ strs.ref = 1;
str = (FcChar8 *) lang;
}
return &ls;
/*
- * $XFree86: xc/lib/fontconfig/src/fclist.c,v 1.9 2002/08/19 19:32:05 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fclist.c,v 1.10 2002/08/22 07:36:44 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
for (v1 = v1orig; v1; v1 = v1->next)
{
for (v2 = v2orig; v2; v2 = v2->next)
- if (FcConfigCompareValue (v1->value, FcOpEqual, v2->value))
+ if (FcValueEqual (v1->value, v2->value))
break;
if (!v2)
return FcFalse;
for (v2 = v2orig; v2; v2 = v2->next)
{
for (v1 = v1orig; v1; v1 = v1->next)
- if (FcConfigCompareValue (v1->value, FcOpEqual, v2->value))
+ if (FcValueEqual (v1->value, v2->value))
break;
if (!v1)
return FcFalse;
e1 = FcPatternFindElt (p1, os->objects[i]);
e2 = FcPatternFindElt (p2, os->objects[i]);
if (!e1 && !e2)
- return FcTrue;
+ continue;
if (!e1 || !e2)
return FcFalse;
if (!FcListValueListEqual (e1->values, e2->values))
/*
- * $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.19 2002/08/19 19:32:05 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.20 2002/08/20 23:17:03 keithp Exp $
*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
case FcOpOr:
case FcOpAnd:
case FcOpEqual:
- case FcOpContains:
case FcOpNotEqual:
case FcOpLess:
case FcOpLessEqual:
case FcOpMore:
case FcOpMoreEqual:
+ case FcOpContains:
+ case FcOpNotContains:
case FcOpPlus:
case FcOpMinus:
case FcOpTimes:
FcElementLessEq,
FcElementMore,
FcElementMoreEq,
+ FcElementContains,
+ FcElementNotContains,
FcElementPlus,
FcElementMinus,
FcElementTimes,
{ "less_eq", FcElementLessEq },
{ "more", FcElementMore },
{ "more_eq", FcElementMoreEq },
+ { "contains", FcElementContains },
+ { "not_contains",FcElementNotContains },
{ "plus", FcElementPlus },
{ "minus", FcElementMinus },
{ "times", FcElementTimes },
{ "less", FcOpLess },
{ "less_eq", FcOpLessEqual },
{ "more", FcOpMore },
- { "more_eq", FcOpMoreEqual }
+ { "more_eq", FcOpMoreEqual },
+ { "contains", FcOpContains },
+ { "not_contains", FcOpNotContains }
};
#define NUM_COMPARE_OPS (sizeof fcCompareOps / sizeof fcCompareOps[0])
case FcElementMoreEq:
FcParseExpr (parse, FcOpMoreEqual);
break;
+ case FcElementContains:
+ FcParseExpr (parse, FcOpContains);
+ break;
+ case FcElementNotContains:
+ FcParseExpr (parse, FcOpNotContains);
+ break;
case FcElementPlus:
FcParseExpr (parse, FcOpPlus);
break;