Search code examples
firefoxfonts

How do I block or substitute a certain font in Firefox?


I have Helvetica installed on my Windows XP PC, which is great for designing, but Helvetica looks horrendous when displayed in a browser on PC.

For example, I visit a website with this style:

font-family: Helvetica, Arial, sans-serif;

Helvetica is selected, as it is installed on my system.

Can I force Firefox to pretend Helvetica isn't installed on my system, and render these pages using Arial?


Solution

  • The other day I came across a site that used Comic Sans, and I decided I wanted to replace it with Verdana. I did some googling and found this Greasemonkey script which removes Comic Sans from any website you visit. I rewrote that script to replace Helvetica with Arial

    var tags = document.getElementsByTagName('*');
    for (var i in tags) {
        var style = getComputedStyle(tags[i], '');
        if (style.fontFamily.match(/helvetica/i)) {
            var fonts = style.fontFamily.split(',');
            for (var j in fonts) {
                if (fonts[j].match(/helvetica/i)) {
                    fonts[j] = 'arial';
                }
            }
            tags[i].style.fontFamily = fonts.join(',');
        }
    }