The guys from Redmond have a habit of taking care of the looks quite a bit more than of security and that is actually to our advantage. We can 'borrow' their fonts for use in X. Note that the use of those fonts is only allowed if you have a valid windows license, or if you have downloaded the fonts from their site.
This text assumes you use XFree 4.2.0, that you have a reasonable knowledge of the CLI and *NIX commands, that you have a working setup of X and a reasonably recent distribution. You should also have perl and freetype on your system.
Step 1: Preparing the fonts and the directory.
Unpack and/or move (from a windows partition) the ttf files to a directory under /usr/X11R6/lib/X11/fonts, for instance Truetype. The fontserver prefers the filenames to be in lowercase, so use this script on the files (I am reasonably sure the use is selfexplanatory?). Download the program ttmkfdir here. Unpack it and put the file ttmkfdir.linuxbin.glibc2 somewhere where you can run it from, such as /usr/local/bin. Then make a symlink to it called ttmkfdir since I am sure you don't want to type all of that every time you use it Next, download this file and also put it in the /usr/local/bin directory. Once you have all that set up, you cd into the directory with the truetype fonts. Run the command:
$ cd /usr/X11/lib/X11/fonts/Truetype $ chmod u+x /usr/local/bin/mkfontalias.py $ ttmkfdir -o fonts.scale $ mkfontdir $ mkfontalias.py
After these commands you should see the following files: fonts.alias, fonts.dir and fonts.scale.
Step 2: Modifying the config files.
Next thing to do is modifying the various configuration files to reflect the new fonts you have added and make the most of them. Go and find the file XF86Config-4 or XF86Config. If both are found, the -4 version gets used. They can usually be found at /etc/X11 or /usr/X11/lib/X11. Open it and look for the following section:
Modify the lines under that section to look like this:
FontPath "/usr/X11R6/lib/X11/fonts/Type1" FontPath "/usr/X11R6/lib/X11/fonts/util" FontPath "/usr/X11R6/lib/X11/fonts/misc:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/100dpi:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/75dpi:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/Speedo" FontPath "/usr/X11R6/lib/X11/fonts/TTF" FontPath "/usr/X11R6/lib/X11/fonts/Truetype" FontPath "/usr/X11R6/lib/X11/fonts/cyrillic" FontPath "/usr/X11R6/lib/X11/fonts/encodings" RgbPath "/usr/X11R6/lib/X11/rgb" ModulePath "/usr/X11R6/lib/modules"
This will make sure X can find the fonts. Next, hunt for the file called XftConfig. It can usually be found in the same directory as XF86Config. Look for the line:
Modify the lines there to show:
dir "/usr/X11R6/lib/X11/fonts/Type1" dir "/usr/X11R6/lib/X11/fonts/TTF" dir "/usr/X11R6/lib/X11/fonts/TrueType"
This will make sure the fontserver will be able to find the fonts as well.
Step 3: Sit back and enjoy your work.
Fire up X again and you should be able to see that you now have the use of Truetype fonts in X.
In the next installment, you will learn how you can get KDE to show your fonts anti-aliased. I assure you, that looks positively stunning.