Qt fonts HOWTO

This is a short HOWTO describing what is needed to get a good font support with Qt applications on X11. It is mainly interesting for distributors or people setting up Unix font support on their own. It is by no means complete, and you'll have to work out some of the details I just sketch by yourself.

Enjoy,
Lars

(updated by Ivan E. Moore II rkrusty@debian.org with Debian specific information).

Contents

  1. Getting Antialiased fonts on XFree86 with Qt & KDE
  2. Getting a nice looking desktop without antialiased fonts
    1. Bitmapped fonts on X11
    2. Add existing scalable fonts to your fontpath
    3. Using true type fonts
  3. Using true type and postscript fonts for printing in KDE
  4. Where to find nice looking true type fonts on the web
    1. Getting good fonts for other scripts than latin
  5. Resources on the web

1. Getting Antialiased fonts on XFree86 with Qt & KDE

You will need to follow a few steps to get antialiased fotns on your X11 desktop. Please note, that parts of the X11 code for the rendering extension are still experimental and drivers do not exist for all graphics hardware.

There are a few preconditions you'll have to meet: (most are auto with Debian)

Once you have all this, you can see if the rendering extension is available, by looking at the output of xdpyinfo and checking if RENDER is listed as an extension.

If yes, you'll need to get a Qt-2.3.0 or later compled with Xft support. If you compile Qt yourself, add -xft to the configure line.

You will need some nice looking true type fonts to really enjoy the Xft extension to X11. See Chapter 4 in this HOWTO on where to get some. The Microsoft webfonts are of very high quality and a good start.

After having downloaded them, you will need to add the path to your true type fonts to the XftConfig file in /etc/X11.

Now set the environment variable QT_XFT to true and start any Qt appliction (for example the designer). You should hopefully get nice antialised fonts.

In case you are running KDE and don't get any fonts on your desktop, try removing the ~/.kde/share/config/kdefonts file.

2. Getting a nice looking desktop without antialiased fonts

2.1. Bitmapped fonts on X11

The standard X11 distribution comes with a set of bitmapped fonts. Unfortunately, the standard setup allows the XServer to scale these fonts. As scaled bitmap fonts look really ugly, the first thing to do is to tell the XServer not to scale these fonts. This can be done, by editing the XF86Config file.

Replace all font path entries pointing to directories containing bitmapped fonts as for example:

    FontPath "/usr/lib/X11/fonts/75dpi"
by
    FontPath "/usr/lib/X11/fonts/75dpi:unscaled"
Like this you'll never again see ugly scaled bitmapped fonts on your screen.

2.2. Add existing scalable fonts to your fontpath

There are a lot of free scalable fonts out there, that can be downloaded and used. Some of them are distributed with X11 and some with ghostscript. The sclable fonts distributed with X11 are automatically included in your fontpath, so there is no need to worry about them. But you might want to add the postscript fonts coming with ghostscript to your list of scalable fonts.

The