summaryrefslogtreecommitdiff
path: root/src/fclist.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2003-07-20 16:06:18 +0000
committerKeith Packard <keithp@keithp.com>2003-07-20 16:06:18 +0000
commit74a623e02efc23a39fb35e8d338858877b8f89e7 (patch)
tree874806142bcaf5a7eaa3a0ccc0d83a1b799a7acc /src/fclist.c
parent26da2bb42f91360ecdee9006ff0f8a7ef0609a59 (diff)
downloadfontconfig-74a623e02efc23a39fb35e8d338858877b8f89e7.tar.gz
Implement new semantics for Contains and LISTING:
LISTING requires that the font Contain all of the pattern values, where Contain is redefined for strings to mean precise matching (so that Courier 10 Pitch doesn't list Courier fonts) "Contains" for lang means both langs have the same language and either the same country or one is missing the country
Diffstat (limited to 'src/fclist.c')
-rw-r--r--src/fclist.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/fclist.c b/src/fclist.c
index 47a2f04..0885c93 100644
--- a/src/fclist.c
+++ b/src/fclist.c
@@ -120,17 +120,33 @@ FcObjectSetBuild (const char *first, ...)
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 (v1->value, FcOpContains, v2->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
@@ -196,7 +212,8 @@ FcListPatternMatchAny (FcPattern *p,
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;
@@ -415,7 +432,8 @@ FcFontSetList (FcConfig *config,
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;
}