Back to Silas S. Brown's home page | X11 configuration

FreeType in low resolution

These notes are old: this setting should not be necessary on newer GNU/Linux machines, which in any event are likely to require high DPI settings instead of X11 hardware magnification. I'm leaving this page up in case anyone still has an older environment.
Modern X11 applications tend to use the FreeType font system. This is fine in high resolutions because you can set the screen DPI to a large value and have all the fonts enlarged instantly. However, in low resolutions, some versions of FreeType do not render fonts so well.

If you find yourself in that situation, it can be better to use the largest fixed-size fonts instead and adjust the display resolution rather than the font size. If you often work in low resolutions (perhaps because some of your applications don't use FreeType, or they have graphical controls that won't enlarge, or you need the scrollable desktop estate) then you might want to get FreeType to use the older fonts too.

  1. Make the fixed size fonts available in FreeType.  In most cases you can do this by creating a symbolic link to the top of the X fontpath, like this:
    cd ~
    mkdir .fonts
    ln -s $(xset q |
            grep /fonts/ |
            head -1 |
            sed -e "s|fonts/.*|fonts|") .fonts/fontpath
  2. Download my .fonts.conf and customise as necessary (this one asks for 20-pixel fonts)
  3. Edit your .Xresources and check the setting of Xft.dpi.  Add a line if it isn't there already; it should look like this:
    Xft.dpi: 125
    The ideal DPI setting is probably 7.2 times the pixel size of your bitmap fonts (so 144 for 20-pixel) but it seems that some installations of FreeType work better if you reduce it a little; you may need to experiment to get the best size.
Some versions of FreeType contain a bug that prevents it from loading the bitmap fonts.  You can check by running fc-list : file | grep dpi after making the above changes; if there is no output then your system has the bug.  If you find yourself on such a system then undo the first two steps (rm -rf ~/.fonts*) and try to find some fonts that FreeType doesn't render too badly.  You can try installing the Debian package msttcorefonts but the results are still likely to be less readable than the bitmaps.  It may help to add the following to your Xresources (it's already there in the ones on this site) :
Xft.hinting:    true
Xft.hintstyle:  hintslight
Xft.antialias:  0

All material © Silas S. Brown unless otherwise stated.