11

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?

3 Answers 3

10

The following instructions do not require any plugins or addons, which is a bonus.

  1. Find your profile folder.
  2. Navigate to the subfolder 'chrome'. If it doesn't exist, create it.
  3. Now inside that folder, create an empty file called 'userContent.css'.
  4. Open that file in a text editor, and add this text (all on one line): @font-face { font-family: 'Helvetica'; src: local('Arial'); }
  5. Save that file and restart firefox.

Just a note about step four. You may need to replace several fonts, so you should copy and paste that line but replacing each font. For example, I need this: @font-face { font-family: 'helvetica neue'; src: local('Arial'); }.

4
  • See also: superuser.com/a/532623/460302, especially regarding the requirement (at least as of FireFox 55.0.3) to use the !important directive.
    – CODE-REaD
    Commented Oct 19, 2017 at 16:27
  • 1
    @CODE-REaD, CSS at-rules do not have the ! important syntax. Only selectors and pseudo-{classes,elements}, i.e. those subject to specificity, do. Commented Sep 14, 2022 at 23:57
  • 1
    Thanks, and for posterity, this 8yo recipe works like a charm as of FF 150.0b9 (Dev. Ed.)! Commented Sep 15, 2022 at 0:10
  • On Firefox 125, using !important works. Not using it only half-works: the devtools reports using the wrong font, but the render is sometimes correct. Commented May 11 at 17:50
8

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(',');
    }
}
3
  • This ALMOST works, I checked a Helvetica'd page in Firebug and for some reason the script is adding " Light" to the end of the font. So I ended up with: font-family:"Arial ! important Light",Helvetica,Arial,sans-serif; Same thing happened when I removed the "! important" and tried a few other fonts. Any idea where this mystery " Light" is coming from?
    – Ben
    Commented Aug 3, 2009 at 2:04
  • 1
    I edited my post. The new code should work. The website you were looking at probably had Helvetica Light as the first font.
    – Rob
    Commented Aug 3, 2009 at 15:44
  • Sorry to comment an old solution, but I would like to let you know that in Firefox 19.0.2 getComputedStyle() is reported as an unsupported operation.
    – 2rs2ts
    Commented Mar 20, 2013 at 4:42
1

I think User CSS/User Styles can help in that you can force the browser to override the pages style.

Some tutorials to help

Not the answer you're looking for? Browse other questions tagged or ask your own question.