DPI (Dots Per Inch) -- 100dpi versus 75dpi

If you use a screen resolution greater than 800x600 in Linux with most monitors, you will have a slightly fuzzy display, in spite of anti-aliasing (AA). It seems every distro of Linux defaults to 75dpi, and why that is has yet to be explained, but SuSE is no different. A higher number dpi simply means more pixel dots per square inch of screen space for a finer-grained font rendering. Here's how to fix that.

First, install the 100dpi fonts package from your version of Linux. The process of installing seems to make several changes in the system so that it becomes an option. Make sure that the 100dpi fonts are listed first in order before the 75dpi fonts in these files:

   /etc/X11/XF86Config
   /usr/X11R6/lib/X11/XftConfig
   /etc/fonts/fonts.conf

(More on that last item in the Font Fight HOWTO.)

Next, be ready to fix the display parameters for every application that does not use AA. For example, every application that uses Motif or Lesstif libraries must have comments in your ~/.Xresources file to correct the display. It's quite complicated, and you'll have to read up on how to make changes for your specific favorites, but here's an example of what I did for Nedit:

nedit*fontList: -adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*
nedit*helpFont: -adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*
nedit*boldHelpFont: -adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*
nedit*italicHelpFont: -adobe-helvetica-medium-i-normal-*-12-*-*-*-*-*-*
nedit*fixedHelpFont: -abode-courier-medium-r-normal-*-12-*-*-*-*-*-*
nedit*boldFixedHelpFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*
nedit*italicFixedHelpFont: -adobe-courier-medium-i-normal-*-12-*-*-*-*-*-*
nedit*h1HelpFont: -adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*
nedit*h2HelpFont: -adobe-helvetica-medium-i-normal-*-12-*-*-*-*-*-*
nedit*h3HelpFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*
nedit*helpLinkFont: -adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*
nedit*XmList.fontList: -adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*
nedit*XmText.fontList: -adobe-courier-medium-i-normal-*-12-*-*-*-*-*-*
nedit*FileSelect*XmList.fontList: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*
nedit*XmTextField.fontList: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*
nedit*statsForm*fontList:  -adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*

I couldn't get TrueType fonts to work, but the format for naming the font preference is the standard for X. In brief, look in the fonts.dir file wherever your chosen font resides, and you'll see a list of fonts that resemble that format. The asterisks between the hyphens simply allows the system to choose those parameters. If you really want to know more about this, you'll have to look it up. The proper search term is "xlfd" or you can try: "Fonts Naming Convention: XLFD" or see this chart.

If you use Mozilla or Netscape 7.x in the tarball or auto-download version from the FTP site, it uses the older GTK libs. To fix the display for anything in GTK1.x applications, edit your ~/.gtkrc so that somewhere in the file, you have and entry like this:

style "default"
{
        font = "-monotype-arial-normal-r-normal--12-*-*-*-*-*-*-*"

This is usually at the head of a section of default colors, and is probably commented out by default. You can choose any font using the standard notation format as shown. You may need to capitalize, depending on how it appears in the fonts.dir for that font folder. Don't have a .gtkrc? Copy one from your favorite GTK1 theme (I used Blue-n-Gray) and edit the appropriate line.

You may run into other applications which pop up with huge fonts, and will have to trace it down. Google is your friend! You can also ask me, but I'm hardly a real hacker; I just know how to fix stuff I've researched myself.

After all this, you need to restart KDM so that it reloads the new instructions:

rcxdm restart

plus you need to logout and log back in to restart your X session.

Both KDE and Gnome2 are able to adjust the display for 100dpi, and you shouldn't notice any changes. However, please note that, as far as I can determine, none of your Gnome2 display settings work for Gnome2 applications unless you are running Gnome. You'll get the default Gnome2 display settings when you are in any other desktop or window manager.


By Ed Hurst, updated 16 April 2004
This document released into the Public Domain.