K.Mandla's blog of Linux experiences

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! 👿

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 …

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 … 😯

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. …

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

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. 😉

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.