Re: Oddities and possibile enhancements of :postscriptname pattern with partial matches

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

 



Hi,

Prior to answering your question, I may have to explain how fontconfig works.
fontconfig calculates a score against a given pattern and evaluates
them in hardcoded order (speaking of particular objects here, the
order is something like ... > strong binding of family >
postscriptname > weak binding of family > postscriptname > ... > style
...). If something is higher than others, fontconfig decides it is the
best font for a request. If it is the same score compared to others,
go through objects until finding a higher score one.

So the request pattern has to be accurate. The weird behavior you saw
was caused by that "partial name matching" you misunderstood.

Here is more detailed reason:

On Tue, Dec 3, 2024 at 8:28 PM Francesco Pretto <ceztko@xxxxxxxxx> wrote:
> 1) Why a :postscriptname pattern partially matching name seems it
> can't be used together a :style pattern?

$ FC_DEBUG=7 fc-match :postscriptname=Liberation:style=Italic
...
 postscriptname: 523.81  "Liberation"(s),  "LiberationMono-Italic"(w)
...
Score 0 0 0 0 0 0 0 0 0 1e+99 523.81 2000 1e+99 1e+99 0 0 0 0 0 100000
0 0 0 0 0 0 0 0 2.14735e+12
...
 postscriptname: 285.714  "Liberation"(s),  "LiberationMono"(w)
...
Score 0 0 0 0 0 0 0 0 0 1e+99 285.714 2000 1e+99 1e+99 0 0 0 0 1000 0
0 0 0 0 0 0 0 0 2.14735e+12

At this point, Liberation Mono (Regular) has a lower number than
Liberation Mono Italic no matter what the score of "style" is.

> 2) Why match on a :postscriptname doesn't perform more pattern
> normalizations? For examples it trims spaces, which is good, but it
> doesn't (for example) convert commas ',' to hyphen '-' (which it would
> in general match more fonts);

Does this mean there are any fonts that use a comma in postscriptname?

> 3) Why partial match on :family produces even worse results than on
> :postscriptname?

Basically it is the same reason to 1) but the result depends on what
configuration for substitute fonts you have. "Noto Sans" will be added
by some substitution rule and it will eventually match something as a
fallback in caches. However there are no such families of "Liberation"
available. thus it will be marked as the lowest score.

> Please consider that using the comma as in "LiberationSans,Bold" is
> quite a common convention as suggested in the PdfReference for a long
> time (before ISO standardization) to compose a postscript name for the
> font (read 5.5.2 TrueType Fonts in PdfReference 1.7[2], suggestion
> removed starting with ISO 32000-1:2008).

Thank you for the pointer. Please file an RFE to
https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/new

-- 
Akira TAGOH




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

  Powered by Linux