/*
- * $XFree86: xc/lib/fontconfig/src/fclist.c,v 1.4 2002/06/02 21:07:56 keithp Exp $
+ * $RCSId: xc/lib/fontconfig/src/fclist.c,v 1.11tsi Exp $
*
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ * Copyright © 2000 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
}
if (c < 0)
mid++;
- memmove (os->objects + mid + 1, os->objects + mid, os->nobject - mid);
+ memmove (os->objects + mid + 1, os->objects + mid,
+ (os->nobject - mid) * sizeof (const char *));
os->objects[mid] = object;
os->nobject++;
return FcTrue;
return os;
}
+/*
+ * Font must have a containing value for every value in the pattern
+ */
static FcBool
-FcListValueListMatchAny (FcValueList *v1orig,
- FcValueList *v2orig)
+FcListValueListMatchAny (FcValueList *patOrig, /* pattern */
+ FcValueList *fntOrig) /* font */
{
- FcValueList *v1, *v2;
+ FcValueList *pat, *fnt;
- for (v1 = v1orig; v1; v1 = v1->next)
- for (v2 = v2orig; v2; v2 = v2->next)
- if (FcConfigCompareValue (v2->value, FcOpContains, v1->value))
- return FcTrue;
- return FcFalse;
+ for (pat = patOrig; pat; pat = pat->next)
+ {
+ for (fnt = fntOrig; fnt; fnt = fnt->next)
+ {
+ /*
+ * make sure the font 'contains' the pattern.
+ * (OpListing is OpContains except for strings
+ * where it requires an exact match)
+ */
+ if (FcConfigCompareValue (fnt->value,
+ FcOpListing,
+ pat->value))
+ break;
+ }
+ if (!fnt)
+ return FcFalse;
+ }
+ return FcTrue;
}
static FcBool
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))
* FcTrue iff all objects in "p" match "font"
*/
-static FcBool
-FcListPatternMatchAny (FcPattern *p,
- FcPattern *font)
+FcBool
+FcListPatternMatchAny (const FcPattern *p,
+ const FcPattern *font)
{
int i;
FcPatternElt *e;
e = FcPatternFindElt (font, p->elts[i].object);
if (!e)
return FcFalse;
- if (!FcListValueListMatchAny (p->elts[i].values, e->values))
+ if (!FcListValueListMatchAny (p->elts[i].values, /* pat elts */
+ e->values)) /* font elts */
return FcFalse;
}
return FcTrue;
case FcTypeCharSet:
return FcCharSetCount (v.u.c);
case FcTypeFTFace:
- return (FcChar32) v.u.f;
+ return (long) v.u.f;
+ case FcTypeLangSet:
+ return FcLangSetHash (v.u.l);
}
return 0;
}
if (!s)
continue;
for (f = 0; f < s->nfont; f++)
- if (FcListPatternMatchAny (p, s->fonts[f]))
+ if (FcListPatternMatchAny (p, /* pattern */
+ s->fonts[f])) /* font */
if (!FcListAppend (&table, s->fonts[f], os))
goto bail1;
}