Reputation: 20638
I am using Iceweasel browser (Firefox derivative) on Debian system with an XFCE4 desktop.
I have not defined any custom font substitution in ~/.config/fontconfig/fonts.conf.
This what fc-match tells me currently.
lone@debian:~$ fc-match "Liberation Mono"
n022003l.pfb: "Nimbus Mono L" "Regular"
lone@debian:~$ fc-match Courier
n022003l.pfb: "Nimbus Mono L" "Regular"
lone@debian:~$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
So I expect that when I have an HTML, using 'Liberation Mono' font should provide same results as using 'Courier'. But as can be seen in the screenshot below, this is not the case (JSFiddle: http://jsfiddle.net/8L3rmyxn/).
I clicked on 'Inspect Element' and found the actual fonts used.
For the text using 'Liberation Mono' in CSS, the browser uses 'DejaVu Serif' instead which is not consistent with the output of fc-math.
For the text using 'Courier' in CSS, the browser uses 'Nimbus Mono L' which is consistent with the output of fc-match.
For the text using 'monospace' in CSS, the browser uses 'DejaVu Sans Mono' which is again consistent with the output of fc-match.
Why is it that in case of 'Liberation Mono' font, the browser does not use 'Nimbus Mono L' and instead uses 'DejaVu Serif' font?
Note that I know a way to resolve this issue. If I define an alias for 'Liberation Mono' explicitly in ~/.config/fontconfig/fonts.conf then I get the desired results, i.e. text in 'Liberation Mono' font and text in 'Courier' font appear similar.
lone@debian:~$ cat ~/.config/fontconfig/fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>Liberation Mono</family>
<prefer><family>Nimbus Mono L</family></prefer>
</alias>
</fontconfig>
lone@debian:~$ fc-match "Liberation Mono"
n022003l.pfb: "Nimbus Mono L" "Regular
But my question remains. Why is it that without this explicit alias in fonts.conf, when I specify 'Liberation Mono' font in the CSS, the browser does not use 'Nimbus Mono L' and instead uses 'DejaVu Serif' font, even though the fc-match "Liberation Mono"
outputs the same thing regardless of whether I have defined an alias in fonts.conf or not?
Upvotes: 5
Views: 1873
Reputation: 124
By default Firefox only allows a maximum of 3 replacements via fontconfig.
You can set gfx.font_rendering.fontconfig.max_generic_substitutions
in about:config to increase this limit. The highest value allowed is 127.
Upvotes: 1