[Fontconfig] Why does family under `Best score` differ from that under the preceding `Match Pattern`?
Kynn Jones
kynnjo at gmail.com
Mon Mar 7 02:22:09 UTC 2016
On Sun, Mar 6, 2016 at 6:52 PM, Raimund Steger <rs at mytum.de> wrote:
> On Sun, 6 Mar 2016 17:58:04 -0500
> Kynn Jones <kynnjo at gmail.com> wrote:
>
>> [...]
>> Nevertheless, for some applications, like VirtualBox and VLC, instead
>> of Terminus, what I get is TeX Gyre Chorus, everywhere. (It's a bug
>> with a sense of humor.)
>>
>> I tried running, e.g. VirtualBox, with `FC_EDIT=1`. I include the
>> debugging output at the end of this post, but, in a nutshell, what I
>> see in this output are `Match Pattern` sections where the family is
>> listed as `Terminus` followed by `Best score` sections where the
>> family is listed as `TeX Gyre Chorus`.
>
> If you run with FC_DEBUG=3, you get the scores for all candidates, not just the best one. Then you can figure out where in the score vector is Terminus worse than TeX Gyre Chorus and find out the corresponding fontconfig property by looking at _FcMatcherPriority in fcmatch.c.
>
> But maybe that's not even necessary. Only the following properties have higher priority than strong family: file, fontformat, scalable, color, foundry, charset. Of these, only 'scalable' occurs in the pattern in your case as far as I can tell so it should be a good candidate. (Some people might wonder why 'scalable' has higher priority than strong family as the latter normally indicates a deliberate user preference, but let's keep that aside :-P)
>
> To find out whether that's added to your pattern by a config rule or not, you could try FC_DEBUG=4 which traces all config rule applications. If it's not set by a config rule that is in a file after position 50, you can just set it to "false" in your user config.
Thank you for your comments and suggestions.
I'm stymied by my inability to interpret most of the debugging output
(so the probability that what I write below is wrong is quite high).
*As far as I can tell*, these are the scores for Terminus and TeX Gyre
Chorus (I've added whitespace to make the vector components more
easily comparable):
TeX Gyre Chorus 0 0 0 1 0 0 1001 0 1 1002 0 0 0 0 1 1 1 1 0 0
1 2.14735e+12
Terminus 0 0 0 1001 0 0 1 0 1 1002 0 0 1 0 1 100001 1 1 0 0
1001 2.14748e+12
Supposedly the score for `TeX Gyre Chorus` is the better one, but I
cannot tell why. Nor can I tell what the various components
correspond to. I have not been able to find any documentation about
any of this.
Both score vectors ave have 22 components, AFAICT `_FcMatcherPriority`
has 25 components:
PRI_FILE
PRI_FONTFORMAT
PRI_SCALABLE
PRI_COLOR
PRI_FOUNDRY
PRI_CHARSET
PRI_FAMILY_STRONG
PRI_POSTSCRIPT_NAME_STRONG
PRI_LANG
PRI_FAMILY_WEAK
PRI_POSTSCRIPT_NAME_WEAK
PRI_SYMBOL
PRI_SPACING
PRI_SIZE
PRI_PIXEL_SIZE
PRI_STYLE
PRI_SLANT
PRI_WEIGHT
PRI_WIDTH
PRI_DECORATIVE
PRI_ANTIALIAS
PRI_RASTERIZER
PRI_OUTLINE
PRI_FONTVERSION
PRI_END
Be that as it may, out of desperation, I tried changing my
`fonts.conf` to this (based on one of your suggestions):
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match>
<edit name="family" mode="assign" binding="strong">
<string>Terminus</string>
</edit>
<edit name="scalable" mode="assign" binding="strong">
<string>false</string>
</edit>
</match>
</fontconfig>
Lo and behold! It worked!
I have *absolutely no idea* why.
Thank you all the same!
kj
More information about the Fontconfig
mailing list