FcFontList "contain" semantics unproductive
Submitted by Behdad Esfahbod
Assigned to fon..@..op.org
Link to original bug (#107246)
Description
If I want to list only fonts that have fontformat=TrueType or fontformat=CFF, currently I can't:
behdad:~ 0$ fc-list :fontformat=truetype,cff
Returns empty.
This is because FcFontList interprets that as returning fonts that have both fontformat=truetype AND fontformat=cff. Code:
/*
* Font must have a containing value for every value in the pattern
*/
static FcBool
FcListValueListMatchAny (FcValueListPtr patOrig, /* pattern */
FcValueListPtr fntOrig) /* font */
{
FcValueListPtr pat, fnt;
for (pat = patOrig; pat != NULL; pat = FcValueListNext(pat))
{
for (fnt = fntOrig; fnt != NULL; fnt = FcValueListNext(fnt))
{
/*
* make sure the font 'contains' the pattern.
* (OpListing is OpContains except for strings
* where it requires an exact match)
*/
if (FcConfigCompareValue (&fnt->value,
FC_OP (FcOpListing, FcOpFlagIgnoreBlanks),
&pat->value))
break;
}
if (fnt == NULL)
return FcFalse;
}
return FcTrue;
}
I cannot imagine any scenario that this semantic is useful. I suggest we flip it from an AND to an OR.