Home » Questions » Computers [ Ask a new question ]

How to get Firefox to use MS TrueType fonts for Helvetica, Times, etc?

How to get Firefox to use MS TrueType fonts for Helvetica, Times, etc?

I'm using (Windows) TrueType fonts on my Ubuntu workstation (details), and am mostly happy with how fonts look, both in desktop apps and on the web (using Firefox).

Asked by: Guest | Views: 263
Total answers/comments: 2
bert [Entry]

"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."
bert [Entry]

"Greasemonkey will be one of solution for your question. Install this addon and you can customize the web pages and change the fonts.

and one example script which changes the font to Helvita

// ==UserScript==
// @name Google Reader Font in Helvetica and enlarged
// @version 1.0
// @creator Joe
// @description Changes the font family and size from Google Reader page
// @namespace userscriptsdotorg
// @include www.google.com/reader/*
// @include http://www.google.com/reader/*

// ==/UserScript==

function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}

addGlobalStyle('.entry-body{font-family:Helvetica;font-size:110%;line-height:150%;}');
addGlobalStyle('A.entry-title-link {font-family:Helvetica;font-size: 20px;}');"