Working with Fonts


Sooner or later, you will probably want to install additional fonts in X11 for your applications (such as GIMP).

Although X11 supports several types of fonts, the most commonly installed are Adobe Type 1 and TrueType. Both are extremely popular because they are supported by Windows and Macintosh, as well as newer versions of Xorg. Thousands of Type 1 and TrueType fonts are available free for download from various places on the Internet. Also, commercial fonts are available for purchase in both formats, and X11 can use them regardless of whether they're packaged as "Windows" or "Mac" fonts.

Because these are the most commonly used font types, the following sections describe their use and configuration.

Checking the xorg.conf File for Font Support

The first thing you will need to do is make sure the xorg.conf file contains the proper modules to support the fonts you want to use. The xorg.conf file was covered in detail under the section "Understanding the xorg.conf File," earlier in this chapter. You need to check the file /etc/X11/xorg.conf for the appropriate Load line under the Module section.

This line is necessary to support Adobe Type 1 fonts:

Load "type1"


This line is necessary to support TrueType fonts:

Load "freetype"


The preceding lines need to be located under the following heading in xorg.conf:

Section "Modules"


You also need to make sure an appropriate font directory exists in the Files section to hold the new fonts. Look for the lines in xorg.conf that begin with FontPath. If you are installing a TrueType font, I suggest that you add the following line after the last FontPath statement in the file to hold all your TrueType fonts:

FontPath "/usr/X11R6/lib/X11/fonts/TrueType/"


After you add this line, save the file and then exit the editor.

Creating the Directories and Installing the Fonts

Now, you must create the directory, if it doesn't already exist. As root, issue the following command:

mkdir /usr/X11R6/lib/X11/fonts/TrueType


This command creates the directory for the TrueType fonts.

Note

You may notice that X11 is one subsystem that doesn't obey the traditional FreeBSD separation between the /usr/local subtree and the rest of the system, discussed in detail in Chapter 12, "The FreeBSD Filesystem." When you install additional fonts for use in X11, it's a good idea to create a location for them within the design of the FreeBSD filesystem, such as /usr/local/X11/fonts (with appropriate subdirectories for different font types), and then use additional FontPath lines in xorg.conf to tell X11 to look for your fonts there. That way, if you have to perform a backup or transfer your system's data to a new installation, your downloaded and purchased fonts will be safely stored along with everything else in /usr/local.


When you have a directory for the fonts, copy the font files for the fonts you want to add into the appropriate directory. Type 1 fonts should be copied into /usr/X11R6/lib/X11/fonts/Type1, and TrueType fonts should be copied into /usr/X11R6/lib/X11/fonts/TrueType. The fonts only need read access, so you may want to change the permissions on the fonts so that they only have read access for everyone. You can do this with the following command:

# chmod 444 fontname


Here, fontname is, of course, the name of the font file you just installed. (Make sure you are currently in the right font directory. If you need help with basic shell commands and navigation through the directories, see Chapter 8, "Working with the Shell.")

Next, you must run a couple of programs to set up the fonts correctly.

To set up TrueType fonts, you need the program ttmkfdir. It is available in the FreeBSD ports collection under the directory x11-fonts. To set up Adobe Type 1 fonts, you need the program type1inst, also available in the FreeBSD ports collection under the x11-fonts directory (its port name is p5-type1inst, as it's a Perl package). See Chapter 16 for information on how to install software from the ports collection.

After you have copied the fonts to the appropriate directory, make sure you are in that directory and type one of the following commands at the command prompt.

For TrueType fonts:

# ttmkfdir > fonts.scale


For Adobe Type 1 fonts:

# type1inst > fonts.scale


You now must run just one more command: the mkfontdir command recognizes the new fonts and adds them to the font configuration file. To set up scalable fonts, such as Type 1 and TrueType, you need to run the command with the -e option. Once again, make sure you are in the directory to which you copied the fonts and then issue the following command from the prompt:

# mkfontdir -e /usr/X11R6/lib/font/encodings


Next, restart X11 (if you are currently in it), and your new fonts should be available for use.

Note

Whenever you add new fonts to the system, you must repeat ttmkfdir or type1inst, followed by the mkfontdir procedure.





FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net