Howto: Beat Firefox’s UI fonts into submission

If I understand the Mozilla help pages correctly, Firefox (version 2, anyway) ignores your GTK settings for font size, preferring instead to calculate the appropriate sizes against the dimensions given in your xorg.conf file.

What that means is, if your xorg.conf file is hand-edited (like mine, in my Crux system), or if Firefox just doesn’t seem to interpret it properly, you end up with gigantamo UI fonts throughout (the opposite is possible too, but I’ve never had that problem). And if there’s anything I hate, it’s a program that pretends to know more than me about my system! :evil:

Anyway, fixing misaligned or miscalculated UI fonts in Firefox is fairly easy. You have the option of editing all the variables through the userChrome.css file inside your ~/.mozilla/firefox/…/chrome/ directory (you’ll probably have to make that file), but that can be mind-numbing in and of itself. You can get them all aligned and forced to the right size, only to discover a submenu or dialog later, that’s still in Reader’s Digest large print edition mode. For example …

window, input, tooptip, menubar, menubutton, menulist, menu, menupopup > * {
 font-size: 9pt !important
}

That works … but that’s not all the styles that you need to fix. The Preferences dialog, for example, will still need correction. And input boxes. And button labels. And … :shock:

Here’s what I prefer (it’s Mozilla’s “fallback” solution, I might add): Open Firefox’s guts — the about:config page. Search for “dpi” and you should get a key called “layout.css.dpi”. On my default installation it was preset to -1 — in other words, Firefox calculates the size according to xorg.conf, and ignores the GTK settings. Grr. …

On my lowly 1024×768 screen, setting that value to 75 (the dot pitch of my LCD) instead of -1 made everything lovely again — a nice, properly sized UI font throughout, and without tweaking every css variable to force 9-point Dejavu Sans Serif. Ah, peace at last. … :mrgreen:

P.S.: I should note that I’ve occasionally seen this font contortion issue in other distributions (including Ubuntu and Arch, at times in the past), not just the home-brewed ones.

About these ads

6 thoughts on “Howto: Beat Firefox’s UI fonts into submission

  1. K.Mandla Post author

    That might be an even better solution. I’ve also seen on other sites where Firefox 3 defaults to the GTK setting (or at least skins them to something similar — is that right?), which is really the way it should be done. I don’t know why in the world Firefox needs to be special, but it’s easy enough to fix, so I can’t complain too much. ;)

    Reply
  2. Jonathan

    I came across this article when I was trying to convince Firefox to honor the GTK font setting in Openbox.

    Firefox casually ignored anything I tried, including the methods appearing thus far.

    I finally got Firefox to behave by configuring the default fonts in GNOME with the ‘appearances’ applet (gnome-appearance-properties). The relevant gconf that it sets is in ~/.gconf/desktop/gnome/font_rendering.

    I’m pretty sure this is a non-issue if GNOME isn’t installed, as it worked without any complaint on another computer with only XFCE installed.

    While on the topic of configuring fonts, I also came across this article (http://beranger.org/index.php?article=2150&page=3k) on freetype2 configuration. It’s only tangentially related to Mozilla UI fonts, but I found it very helpful toward solving my problems.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s