[Fontconfig] Firefox & Typeface Selection

Raimund Steger rs at mytum.de
Fri Apr 18 02:07:46 PDT 2014

Jorge Fábregas wrote:
> On 04/16/2014 11:30 AM, Raimund Steger wrote:
>> What does
>>     FC_DEBUG=1 fc-match "Helvetica Neue, Helvetica, Arial, sans-serif"
>> give you? (It is unlikely that Firefox executes several distinct
>> FcFontMatch calls as in your example)
> Here's the output:
> http://fpaste.org/94721/64044139/

OK- you see in your output that in the "family" property after config 
substitution, Nimbus Sans L occurs before DejaVu Sans, so it has a 
higher priority in the match.
This should be because of the following rule in 30-metric-aliases.conf:

         <alias binding="same">
           <family>TeX Gyre Heros</family>
           <family>Nimbus Sans L</family>

"accept" means that the specified families are inserted in the list 
immediately behind the element the rule's test section (before <accept>) 
There's no similar rule for "Helvetica Neue" in the default config; 
that's why an fc-match invocation where the "family" property is 
initialized with only that font yields a very generic fallback, which is 
really because of 49-sansserif.conf and all following rules that prepend 
a <prefer> alternative to "sans-serif".

You can observe config substitution with FC_DEBUG=4 (grep for 
"Substitute match").

> ("sans-serif" being first) and it returned "DejaVu Sans".  For a moment
> I thought it didn't care about the order of the pattern presented.   I
> guess I need to learn how the scoring system works :)

The exact scoring algorithm (i. e. how the score vector is calculated) 
is mostly not as much a concern when debugging ugly match results as is 
the order inside the "family" property after config substitution.
However, if you have many similar fonts on your system, or if different 
locales come into play, then looking up the details usually pays off...


Worringer Str 31 Duesseldorf 40211 DE  home: <rs at mytum.de>
+49-179-2981632 icq 16845346           work: <rs at interface-ag.de>

More information about the Fontconfig mailing list