How to get Firefox to use MS TrueType fonts for Helvetica, Times, etc?
Edit: I completely updated this answer after getting some breakthrough advice from a colleague.
Here's what I inserted in /etc/fonts/local.conf
(inside the <fontconfig>
element):
<!-- Replace Helvetica with Arial -->
<match target="pattern">
<test qual="any" name="family">
<string>Helvetica</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Arial</string>
</edit>
</match>
Similarly for Times -> Times New Roman. (See my full local.conf
here.) The key was to use binding="strong" for the <edit>
element. (Also, using "assign_replace" mode instead of "assign" causes something similar, except that then it's too aggressive: also Verdana gets replaced with Arial).
Changes in font configurations are effective immediately. Besides testing in Firefox, you can check that it works like this:
$ fc-match helvetica
Arial.ttf: "Arial" "Normal"
If you run into problems, the best help is near: man fonts-conf
. (Although even with the documentation, the workings of the font system seemed somewhat complicated or unwieldy to me.) You can also try to "debug" what's really going on using a command like:
FC_DEBUG=4 fc-match helvetica
In addition, FC_DEBUG=1024 fc-match helvetica
shows the list of config files that affect the font matching.
I had a similar problem in Opera, the solution to which was to disable "Core X Fonts" in the config. I'd suggest seeing if there is a similar option in Firefox.
Other options:
- Check that you definitely don't have a font called "Helvetica" installed, similar things happened to me a few times. IIRC the problem fonts were in folders called
100dpi
and75dpi
in the system font folder (/usr/local/share/fonts
I think). I just moved those folders out of there entirely. - Check the defaults under System > Preferences > Appearance > Fonts.
- Check Firefox's defaults under Preferences > Content.
If you make changes to the core folders you will need to rebuild the font cache with:
sudo fc-cache -f -v