[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
  Web www.spinics.net

Re: how to enforce scalable fonts

On 01/21/11 02:16, Werner LEMBERG wrote:
> [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

Hi Werner,

Welcome to the mess that is fontconfig! :)

>   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?

Well, it's not that clear cut.  For example, you may ask for Times New Roman,
and fontconfig will give you Liberation Serif, or Nimbus Roman No9, or Tinos,
and they are all real substitutes for Times New Roman.

> 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?

Most probably because UTRG__12-ISO8859-1.pcf.gz has a limited charset, which
in the minds of fontconfig is inadequate for your language of choice (en_US?).

Checkout fontconfig/src/fcmatch.c:_FcMatchers to see how fontconfig orders fonts.


>     Werner
Fontconfig mailing list

[Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Legacy]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux