Applications suddenly have big fuzzy ugly fonts


On dist-upgrading some of my boxes from woody to sarge, I was not pleased to note the effect the upgrade had had on the appearance of application fonts under X. Small, neat, sharp fonts had become large, sprawling, fuzzy and ugly. Maybe the guy dealing with font configuration was on acid, or had bad eyesight...

Getting things back to the way they used to be turned out to be a problem with many heads:
DPI of X fonts
Antialiasing
GTK apps
Firefox
Firefox "Deer Park"
KDE apps

DPI of X fonts
The first seemed to be that the X server was now giving 100dpi fonts priority over 75dpi ones, whereas the previous configuration had been the other way round. The solution to this was to ensure that the entries in /etc/X11/xorg.conf were the right way round, with 75dpi fonts listed before 100dpi ones:

Section "Files"
    FontPath    "unix/:7100"            # local font server
    # if the local font server has problems, we can fall back on these
    FontPath    "/usr/lib/X11/fonts/misc"
    FontPath    "/usr/lib/X11/fonts/cyrillic"
    FontPath    "/usr/lib/X11/fonts/75dpi/:unscaled"
    FontPath    "/usr/lib/X11/fonts/100dpi/:unscaled"
    FontPath    "/usr/lib/X11/fonts/Type1"
    FontPath    "/usr/lib/X11/fonts/CID"
    FontPath    "/usr/lib/X11/fonts/75dpi"
    FontPath    "/usr/lib/X11/fonts/100dpi"
EndSection

and similarly for /etc/X11/fs/config:

# paths to search for fonts
catalogue =
/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/cyrillic/,/usr/lib/X11/fonts/75dpi/:unscaled,/usr/lib/X11/fonts/100dpi/:unscaled,/usr/lib/X11/fonts/Type1/,/usr/lib/X11/fonts/CID,/usr/lib/X11/fonts/Speedo/,/usr/lib/X11/fonts/75dpi/,/usr/lib/X11/fonts/100dpi/
# in decipoints
default-point-size = 120
# x1,y1,x2,y2,...
default-resolutions = 75,75,100,100

Antialiasing
The next step was to turn off the antialiasing that was causing the fonts to be all fuzzy. I was lucky enough to find a recipe on Google for this, which was to put the following entry in /etc/fonts/local.conf:

    <match target="font">
        <test compare="more" name="size" qual="any" >
            <double>0</double>
        </test>
        <test compare="less" name="size" qual="any" >
            <double>72</double>
        </test>
        <edit mode="assign" name="antialias" >
            <bool>false</bool>
        </edit>
    </match>

GTK apps
GTK apps were still using overlarge fonts for the widgets. In the case of gimp, the cure was extremely simple: to create a custom theme - by copying an existing theme to ~/.gimp-2.2 with a new name - and change the entry
font_name = "sans 8" to font_name = "arial 9". This gave the same appearance as the default appearance of the woody version of gimp.

For other GTK apps, it could be fixed by creating a file ~/.gtkrc-2.0 containing:

style "default"
{
     font_name = "Arial 9"
}
class "*" style "default"

I think I found this recipe on Google as well.

Firefox
Since one of the major reasons I wanted to upgrade to sarge was to be able to use versions of firefox from 1.0 onwards, which in binary form are incompatible with the woody libc version and in source form suffer from the usual mozilla/firefox problem that it takes weeks of hacking around just to get the bloody thing to compile, I was most happy to find version 1.0.4 in sarge in Debianised form. I was less happy to discover that it was right out the bloody window as far as fonts were concerned, and strongly resisted all attempts to make it use the same fonts as the non-Debian, binary-tarball-installed 0.8.0 version I had been using previously...

Not only was it still using Peter-and-Jane fonts for the menu bar, widgets etc. in defiance of the ~/.gtkrc-2.0 entries that had successfully tamed other GTK apps, the fonts it used to render HTML were totally different from what was present in 0.8.0. No matter what settings I used in the Preferences/General/Fonts and Colours dialogue, web pages still looked like shit. Fonts with the same name as in version 0.8.0 - "Times New Roman", "Arial" etc. - looked nothing like what they used to look like, irrespective of point size. Nor did any of the other fonts listed in this dialogue resemble those I was used to - and half of them didn't work anyway.

I tried other versions of firefox direct from upstream and found they all had the same problem. Decent fonts seemed to be available only in 0.x versions. I did notice, however, that 0.x binary tarballs were published in two versions - "plain", and "with GTK2/xft support" - whereas 1.x tarballs were only available in one version, GTK2/xft support having become the default.

Due to the lack of the appropriate libraries in woody, the 0.8.0 version I had been using was of the "plain" variety, lacking GTK2/xft support. This gave me an idea. I downloaded the Debianised source package for 1.0.4 (trusting that the Debian geniuses would have rectified its native reluctance to compile - which they had), edited debian/rules to disable xft support (ie. changed the line "--enable-xft" to "--disable-xft"), and built it. Success! Well, nearly. Web pages now rendered just the same as they did in 0.8.0, but the menus, dialogues etc. seemed to be using Times New Roman... weird.

(Interestingly, lsof reveals that the non-xft version I built is still using libxft2. So I am baffled as to what exactly is going on, but it works, which is the main thing.)

It seems that the standard way to tell firefox what widget font to use is to make an entry in ~/.firefox/default/XXXXXXXX.slt/chrome/userChrome.css, where "default" signifies that it's the default user profile and "XXXXXXXX" is the apparently random string of characters which firefox uses to name profile directories to put you off editing the contents. So an appropriate entry was made:

  {
    font-size: 9pt !important;
    font-family: arial !important;
  }

For some reason this didn't work... well, it half-worked; it got the font right but the size wrong. Solving this last problem required another line in ~/.gtkrc-2.0, so the file now looked like this:

gtk-font-name = "helvetica 9"

style "default"
{
     font_name = "Arial 9"
}
class "*" style "default"

The new first line successfully coerced firefox to use the same font for menus and widgets as other GTK apps were now using. Yes, I know it says "helvetica" whereas the entry that works for other GTK apps says "arial". Don't ask me why, that's just what worked. Fonts do my head in...

So, to summarise:
 - Build firefox with xft support disabled
 - Edit ~/.firefox/default/XXXXXXXX.slt/chrome/userChrome.css as above
 - Edit ~/.gtkrc-2.0 as above

Firefox "Deer Park" from unstable
Due to the bug which has persisted over many versions of Firefox - that clicking the "Go" drop-down menu, or accidentally passing the mouse pointer over it having clicked one of the other drop-down menus, causes it to hang and eat 100% CPU for minutes on end (it does eventually free up, but it takes several minutes) - I decided to try backporting the "Deer Park" build of firefox (1.4.99+1.5rc3.dfsg-2) from unstable, for which an extension is available that allows the "Go" menu to be deleted. To get the UI fonts to work was fairly simple - delete the "with-default-toolkit=gtk2" line from debian/rules and change "--enable-pango" to "--disable-pango", then rebuild the package. That got the UI fonts looking as they always had. However, getting it to display web pages in the same manner as its predecessors was an absolute flaming bloody nightmare. I ended up having to make entries in userContent.css to change the behaviour of web pages on an individual basis, and having to delete the Verdana and Arial fonts from my system entirely. When I found that entries in userContent.css were randomly ignored, I gave up and decided to use Opera instead, since it has now "gone free" - it hasn't really, you still can't get the source, but you can download the binary for free, and the bugs in it are less annoying than the ones in Firefox :-)

KDE apps
KDE applications also suffered from the huge-ugly-font syndrome, but in this case the solution was much easier - simply run kcontrol and select smaller, neater ones. The result of this seemed to be the creation of a ~/.kderc (I didn't have one before; I don't have the full KDE environment installed, just some of the apps) containing:

[General]
StandardFont=Arial,9,-1,5,50,0,0,0,0,0
activeFont=Arial,9,-1,5,75,0,0,0,0,0
fixed=Courier New,9,-1,5,50,0,0,0,0,0
font=Arial,9,-1,5,50,0,0,0,0,0
menuFont=Arial,9,-1,5,50,0,0,0,0,0
taskbarFont=Arial,9,-1,5,50,0,0,0,0,0
toolBarFont=Arial,9,-1,5,50,0,0,0,0,0

The "StandardFont" line was also added to ~/.kde/share/config/kdesktoprc:

[FMSettings]
StandardFont=Arial,9,-1,5,50,0,0,0,0,0

and all the other fonts were added to ~/.kde/share/config/kdeglobals:

[General]
fixed=Courier New,9,-1,5,50,0,0,0,0,0
font=Arial,9,-1,5,50,0,0,0,0,0
menuFont=Arial,9,-1,5,50,0,0,0,0,0
taskbarFont=Arial,9,-1,5,50,0,0,0,0,0
toolBarFont=Arial,9,-1,5,50,0,0,0,0,0

[WM]
activeFont=Arial,9,-1,5,75,0,0,0,0,0

Recursive case-insensitive grepping of ~/.kde for "font" didn't produce any other references, so I would guess that setting up these entries directly would be a viable way to automate the process. So far, I haven't found any other unsatisfactory fonts... when I do, I shall update this page with the fixes.

Did you find this page helpful?




Back to sarge page


Back to Pigeon's Nest


Be kind to pigeons




Valid HTML 4.01!