Re: Questionable usage of FcPatternAddInteger()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fabian Greffrath wrote:
FcFontSort() doesn't necessarily returns only FcPatterns matched the
given pattern. it returns FcPatterns sorted by the score according to
the result of matching the pattern. I guess what you are expecting to
see may be more close to FcFontList() perhaps.

Thanks for your reply, but this doesn't really answer my question.

Well, part of your question was why FcFontSort didn't restrict the list, wasn't it?

Other than that: I tried the attached example with the argument 'FreeMono', and as you suggested, it produces pretty identical results to 'fc-match --sort FreeMono:spacing=mono', with FreeMono on top of the list because it's the closest match. So I can find nothing wrong with the way you build the pattern.

(If you leave out the call to FcPatternAddInteger, you might get a different order because a missing element produces a slightly different score in the match.)

Whether fontconfig is able to substitute Liberation Mono for FreeMono on a system where the latter isn't available is another story. (Meaning, treating it as a closer match than other fonts.) This benefits from appropriate rules in fontconfig's configuration files, which typically operate on 'family', not on 'spacing' (the priority of 'family' in the match is higher than that of 'spacing' anyway). These work through the generic family name 'monospace'. I. e. adding 'Liberation Mono' for the monospace family in 60-latin.conf improves its eligibility as a substitute for FreeMono. Although on a system where it isn't clear what kind of monospace font is available it would be an option to use the generic family name directly.

Raimund
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig


[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux