[Fontconfig-bugs] [Bug 107246] New: FcFontList "contain" semantics unproductive

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jul 16 12:04:38 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=107246

            Bug ID: 107246
           Summary: FcFontList "contain" semantics unproductive
           Product: fontconfig
           Version: unspecified
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: library
          Assignee: fontconfig-bugs at lists.freedesktop.org
          Reporter: freedesktop at behdad.org
        QA Contact: freedesktop at behdad.org

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fontconfig-bugs/attachments/20180716/a6878981/attachment.html>


More information about the Fontconfig-bugs mailing list