|
linux.org.mt
|
sponsored by:
|
| Contact us - Home | ||
Installing Truetype Fonts in Linux
lingwi/languages: en
One of the nice features of Windows is that there are many high-quality fonts available for it. This article explains how to use these Truetype fonts under Linux. Author: Ramon Casha Date: 5 June 2001 Contents
- Introduction
- Installing Truetype fonts
- Troubleshooting
- See Also
Introduction
Applicability
Note that older versions of Linux (or rather, XWindows) might not include support for Truetype fonts, or might have a different way of setting them up.
If you're using a recent version of Mandrake, RedHat or SuSE you should be ok, but if you're unsure about whether your distribution supports this technique, open a terminal window and type in the command "ttmkfdir". This command should simply display the number "0", or else a long list of font names. If you get "command not found", then unfortunately these instructions cannot be used - in that case search your distribution's website for alternative instructions.
Background
XWindows, the graphical user interface that comes with Linux, supports many types of fonts, including Adobe's Type1, and Apple's Truetype fonts. This is because the font renderer in XWindows is a separate program, so support for a new font type (such as truetype) can be added separately from the rest of XWindows. While Linux comes with a selection of fonts already installed, there is a much wider selection of Truetype fonts available on the web, as well as bundled with various products, than there are other kinds of fonts.
Fortunately for Linux users, adding Truetype fonts to the system is quite easy. The end result is that you will have a wider choice of very clear and high quality fonts to use with your applications.
TrueType Trivia
Truetype fonts were originally developed by Apple computers, and aimed to address some of the limitations of Adobe's Type1 as well as to include some new displaying techniques etc. Microsoft, which had also been looking for a font format for its Windows OS, licensed this technology from Apple and continued improving it.
Installing Truetype fonts
Mandrake 8.0+
With Mandrake, you can use the DrakFont program, accessible from within the Mandrake Control Centre. This program performs exactly the same steps as for the other distributions described below, but automates the whole process. If you have a dual-boot setup it can copy the fonts from the Windows directory; alternatively it can copy fonts from any directory you select.
Select the Fonts option in Mandrake Control Center, then select "Add Fonts" or "Get Windows Fonts". If you select "Add Fonts", select the directory in which the fonts are currently stored. This will display a list of fonts from the specified directory. Select "Add All", or choose those fonts you want to install and click "Add Selected Fonts". This will add the selected fonts. Some applications might not recognise the newly added fonts until the font server is restarted.
Other Distributions (RedHat, SuSE etc)
Prepare a directory for your fonts
Note: Some of these instructions have to be carried out as the root user.
Ideally, create a new directory for your truetype fonts. Normally I create a directory /usr/local/fonts/ttf, but you can choose any directory you want. This directory should be accessible (but not writeable) by all users.
In the following instructions I use this directory name - if you choose another you should adapt the instructions accordingly.
Copy your fonts
Now, copy all the truetype fonts (*.ttf) that you need into this directory.
If you want to copy the files from the Windows partition, these fonts are normally stored in the windows/fonts directory, or winnt/fonts in the case of Windows NT or 2000.
If you have downloaded fonts as a ZIP file you must use the archiver or the unzip command to extract the font files first. Some self-extracting ZIP executables can also be extracted using the unzip command.
Telling XWindows about your fonts
Now, enter the following commands in sequence from a terminal window:
cd /usr/local/fonts/ttf
ttmkfdir > fonts.scale
mkfontdirIf you view the directory you should now see two new files among the truetype fonts - "fonts.scale" and "fonts.dir". These files simply contain a list with the full font names for each truetype font.
Finally, you have to add the newly set up directory to the list of locations which XWindows will search for fonts.
If you have chkfontpath
RedHat users can enter the following command to add the directory:
chkfontpath -a /usr/local/fonts/ttfIf you don't have chkfontpath
If you don't have the chkfontpath command, you will have to edit the file /etc/X11/xfs/config (or /etc/X11/fs/config), find the line which starts with "catalog=", and add your directory at the end of the list, separated by a comma.
That's it! You can test it now by running the xfontsel program from the terminal, or run the "Font Selector" program from the Utilities menu in Gnome. You should immediately see the truetype font names in the list of fonts.
In older versions of XWindows you may need to restart the font server for it to register the new fonts. The easiest way to do this is to reboot.
Adding more fonts
If you add more fonts to the directory you have to re-run the following commands to regenerate the fonts.dir file:
ttmkfdir > fonts.scale
mkfontdirYou do not have to rerun the chkfontpath command - that is only done when you have a new directory to add.
Troubleshooting
Corrupted font files
Occasionally you may run across truetype fonts which contain internal errors. These could cause the font server to crash as soon as you select it in the font- selection window. If you encounter a similar font you should delete it from the fonts directory and then rerun the commands listed under "Adding more fonts" above.
Not all applications support Truetype
Unfortunately a few applications do not support Truetype. If your truetype fonts work with all other applications but are not even shown in some others, this might be the case. There is very little to do other than try to find a more recent version of the product.
See Also
Copyright © 2001 Ramon Casha
CVS: $Id: ttfonts.xml,v 1.5 2002/04/26 14:27:33 rac Exp $