[Fontconfig] how to enforce scalable fonts
Werner LEMBERG
wl at gnu.org
Thu Jan 20 23:16:58 PST 2011
[fontconfig 2.8.0]
>> I can try to circumvent the issue (this is, using FreeType stuff to
>> test whether a font is scalable), but then it would be necessary
>> that fontconfig returns a list of fonts which exactly fit the
>> search pattern so that I can iterate its elements (or perhaps
>> fontconfig itself provides such an iterator). Is this possible?
>
> Check out FcFontSort().
Thanks. If I interpret this function correctly, the application
itself has to decide how `near' the match is. For example, doing
fc-match -s utopia:regular
on my GNU/Linux box, the first few elements are
UTRG____.pfa: "Utopia" "Regular"
UTRG__12-ISO8859-1.pcf.gz: "Utopia" "Regular"
UTRG__12.pcf.gz: "Utopia" "Regular"
DejaVuSans.ttf: "DejaVu Sans" "Book"
DejaVuSans-Bold.ttf: "DejaVu Sans" "Bold"
DejaVuSans-Oblique.ttf: "DejaVu Sans" "Oblique"
DejaVuSans-BoldOblique.ttf: "DejaVu Sans" "Bold Oblique"
LiberationSans-Regular.ttf: "Liberation Sans" "Regular"
arial.ttf: "Arial" "Normal"
...
so the application must actually test whether the font name is still
the one which is actually searched for.
It seems that FontConfig doesn't provide a function which only returns
the list of fonts which *exactly* match the pattern. Any reason for
this? Or am I missing something?
On the other hand, saying
fc-match -s -a utopia:regular
starts with
UTRG____.pfa: "Utopia" "Regular"
putr.pfa: "Utopia" "Regular"
UTB_____.pfa: "Utopia" "Bold"
putb.pfa: "Utopia" "Bold"
UTI_____.pfa: "Utopia" "Italic"
putri.pfa: "Utopia" "Italic"
UTBI____.pfa: "Utopia" "Bold Italic"
putbi.pfa: "Utopia" "Bold Italic"
UTRG__12-ISO8859-1.pcf.gz: "Utopia" "Regular"
UTRG__12.pcf.gz: "Utopia" "Regular"
UTB___12-ISO8859-1.pcf.gz: "Utopia" "Bold"
UTB___12.pcf.gz: "Utopia" "Bold"
...
I wonder how this can be called `sorted'... Why has putb.pfa (having
a different font series value) a higher priority than
UTRG__12-ISO8859-1.pcf.gz?
Werner
More information about the Fontconfig
mailing list