HOWTO: Clean windows fonts in Slackware linux
After installing Slackware linux on my laptop I noticed the fonts were not as clean looking as they are in windows. The fonts looked as if they were rendered in the wrong resolution even though the system had the correct resolution set for those fonts.
I wanted to use the windows fonts such as ‘tahoma,’ and ‘verdana,’ as they are visually appealing while still being readable. Windows uses a different font resolution to that of linux; default 96 dots per inch (dpi) for windows, and a default of 75 dpi for linux. So all we had to do was install the windows fonts and change the dpi in linux.
Default fonts
click to enlarge
Fonts after changes
click to enlarge
Installing windows fonts
Firstly I installed the windows fonts through the KDE Control Center > System Administration > Font Installer (you must have root privileges to do this). Alternatively, you can do this manually by adding your fonts to the appropriate directory under /usr/X11/lib/fonts. Since we are installing windows fonts (True Type Fonts), the fonts can be added to /usr/X11/lib/fonts/TTF. I also added a reference to this folder in /etc/X11/xorg.conf as it was missing. Add the following under Section “Files”:
FontPath "/usr/X11R6/lib/X11/fonts/TTF"
Make sure the folder /usr/X11/lib/fonts/TTF is also referenced in the file /etc/fonts/local.conf. Run mkfontscale and mkfontdir for the folder and run:
# fc-cache -vf
Changing the DPI
I followed the instructions on this page, but it didn’t work for my system even though it technically should have. The post explains how to set the Xorg display size to obtain the desired font resolution. I did this but the dpi did not change at all. I found another method by editing /usr/X11/bin/startx. To change the fonts to have the resolution that they would have in windows required changing this line:
defaultserverargs=""
to
defaultserverargs="-dpi 96"
I now had my windows font resolution, use the following command to check your system dpi:
# xdpyinfo | grep resolution
resolution: 96x96 dots per inch
Another problem uncovered and fixed
To my surprise the windows fonts appeared the same as the linux fonts: scratchy and blocky around curves. The fix for this was quite simple really: to upgrade the freetype-2.1.9-i486-1.tgz package. This package “is a high-quality and portable font engine that is capable of supporting several font formats (be they bitmapped or scalable) through a simple and uniform interface.” It’s the package that did the trick.
Download the updated Slackware package (make sure it’s 2.2.1 or higher) here. I upgraded to: freetype-2.2.1-i486-1cl.tgz:
# upgradepkg /path/to/file/freetype-2.2.1-i486-1cl.tgz
After restarting X (to rebuild the font cache), my fonts appeared EXACTLY how they did in windows.