A Guide to Administering TrueType Fonts and Commercial Font Managers

Last month I described how the X Window System handles fonts and explained how to install new Type 1 fonts. With TrueType fonts, the fun really begins. The X font facilities and Ghostscript were designed around bitmap and Type 1 fonts and PostScript printing. However, users tend to have access to lots of TrueType fonts, and they naturally want to use them under Linux. Fortunately, support for TrueType fonts within traditional X facilities is available.

Last month I described how the X Window System handles fonts and explained how to install new Type 1 fonts. With TrueType fonts, the fun really begins. The X font facilities and Ghostscript were designed around bitmap and Type 1 fonts and PostScript printing. However, users tend to have access to lots of TrueType fonts, and they naturally want to use them under Linux. Fortunately, support for TrueType fonts within traditional X facilities is available.

Linux’s plain vanilla xfs font server does not understand TrueType fonts, but several servers have been created specifically for TrueType fonts: xfstt (the first TrueType font server), x-tt (a TrueType font server well-adapted to serving Asian-language fonts), and xfsft, which is the one that I will discuss here.

xfsft is a modified version of the xfs font server that is installed by replacing the standard xfs executable file. The xfsft package also provides an updated mkfontdir utility for creating the fonts.dir and fonts.scale files. Some Linux distributions include this font server by default. (Red Hat 6.1′s modified xfs server handles TrueType fonts.)

To install this package yourself you must replace the xfs and mkfontdir executable files and their man pages — you may also need to change your system startup script to reflect any changes in xfs’s calling arguments.

The server is started with a command like the following, which indicates the configuration file xfs will be using and also specifies which TCP port the server will use while listening for font requests:

# xfs -config /etc/X11/fs/config -port 7100 &

Note that the xfsft font server uses the same format for the configuration file as xfs.

You can verify that your font server is working properly using the fslsfonts command. This also works for the vanilla xfs font server, but not for the modified Red Hat one, where network font serving features have been removed:

$ fslsfonts -server
$ fslsfonts -ll -server localhost:7100 -fn “*octavian*”

The first command attempts to connect to the local server on port 7100; the second command queries the server for fonts matching the pattern specified to its -fn option. In the latter case, the command will display lots of information about any fonts containing octavian within their standard X name. The -fn option matches against the X font name.

Once you have a TrueType-capable font server, the procedure for adding new TrueType fonts is almost identical to that for adding Type 1 fonts (which I described in last month’s column). The difference lies in using either the ttmkfdir utility or the modified mkfontdir utility instead of the type1inst utility associated with Type 1 fonts.

Listing One shows two fonts.dir entries for TrueType fonts: Eras Light and Eras Bold.

Listing One: Entering TrueType Fonts in fonts.dir

eraslght.ttf        -itc-Eras Light
erasbd.ttf -itc-Eras Bold

There are two options for printing TrueType fonts from general X applications. The best is to use a version of Ghostscript that has been compiled with the ttfont option, enabling TrueType support with the facility. (It must be a version 5 revision of Ghostscript.) In this case, all you need to do is simply add entries as usual to the Fontmap file pointing to the TrueType font files.

The second alternative is to translate the TrueType fonts into Type 1 fonts using the freely available utilities ttf2pfa, ttf2pt1, and tt1asm. (The ttfutils package provides a convenient integrated front end to these various commands.) Once translated, the fonts can be treated generally or for printing in the same way as native Type 1 fonts. A disadvantage of this approach is that converting between different outline formats is a very difficult problem, and current solutions can sometimes produce pretty ugly results.

Applixware’s FontTastic Fonts

Guru Ap Fonts
Figure One: Adding fonts to Applixware.

Commercial-quality office applications such as Applixware and StarOffice provide their own font-handling mechanisms, which of course translates into additional work for the system administrator. Applixware’s font manager is called FontTastic. It can handle both Type 1 and TrueType fonts, but it is limited to printing at a resolution of 300 dpi. For many purposes, this limitation is unimportant, but if you have a 600 dpi printer and actually need the higher-quality printed output, then you’ll need to bypass FontTastic entirely and use a different, manual procedure for adding fonts.

Adding fonts of either type with FontTastic is straightforward, but the procedure is lengthy. Figure One summarizes the process and illustrates all of the relevant dialogs.

The FontTastic font manager is started via the main Applixware “Tools -> Font Installer” menu path. The resulting window appears on the left of Figure One. Within this dialog, select the “Catalogues -> Create” menu path (marked 1 in the figure), which results in the “Catalogue Creation” dialog (center top in the illustration). Here, enter a name for the new catalog into the corresponding field (2), and verify that the other fields are set as illustrated in the figure.

Clicking “OK” leads to the “Font Installation” dialog. Here you enter the directory location for the new fonts into the “Source Directory” field (3), and then click the “Select Files” button (4). Doing so will give you the “Select Font Files” dialog (on the left in Figure One). Use the “Select Font Files” dialog to specify which fonts within the directory you want add. Entering the appropriate wildcard string into the “File Filter” (5) field will make the process easier for large directories; select the appropriate files from the “Files” list (6) and then click “OK” (7).

Once you have returned to the “Font Installation” dialog, click “Install” (8), and then click “Close” (9) when a process is finished. At this point, you are finally returned to the initial dialog in the sequence, titled “FontTastic Font Manager,” and you can use the “Activate” and “Deactivate” buttons (10) in order to enable and disable use of the fonts you have just added. Once you restart Applixware, the new fonts will be available.

If you want to install the fonts manually, you will need to follow a different procedure. In order to print fonts at resolutions higher than 300 dpi from Applixware, you’ll need to modify its font-configuration file, fontmap. dir, located in axdata/fontmetrics under the main Applixware directory. Each typeface is described by a FontRecord entry within the file. Listing Two shows sample en-tries for the Times Bold Italic and Octavian Italic fonts.

Listing Two: Sample Applixware Font Records

FontRecord = Times-Bold-Italic
Family = Times
Weight = 1
Slant = 1
ScreenName = -applix-axtmj-bold-i-normal–10-80-75-75-p-44-iso8859-1, …
MetricsFile = tmj.afm
PostScriptPrintName = Times-BoldItalic

FontRecord = “Octavian MT Italic”
Family = “Octavian MT”
ScreenName = “-monotype-octavian mt-medium-i-normal–0-0-0-0-p-0-iso8859-1″
Slant = 1
MetricsFile = /more/fonts/type1/oci_____.afm
PostScriptPrintName = OctavianMT-Italic
Type1FontFileName = /more/fonts/type1/oci_____.pfb

The first entry is simplified here. The lines within the entry indicate the font family, the fact that the typeface is bold and italic (Weight=1 and Slant=1, respectively), one or more X names for the font (used for display purposes), the font metrics file, and the name of the corresponding printer font (i.e., the name as defined in the Ghostscript configuration file). The entry for Octavian Italic is very similar, although it includes only one item in the ScreenName line; it also includes an additional line specifying the location of the Type 1 font file rather than relying on the Ghostscript facility to provide this.

Adding fonts to Applixware manually involves making them available to the X Window System and then adding entries for them to this file, following the existing entries as a model. Remember that while FontTastic can handle either Type 1 or TrueType fonts, this manual installation only works for Type 1 fonts.


Guru So Fonts

Guru So Fonts
Figure Two: Adding fonts to StarOffice.

The StarOffice application is also designed to use Type 1 fonts and has its own facilities for specifying available fonts. Figure Two illustrates the dialogs used to add new fonts to StarOffice.

You begin the process by double-clicking on the “Printer Setup” icon in the main StarOffice window (illustrated at the extreme left of Figure Two). From its main dialog, click the “Add Fonts” button, which will bring up the “Font Path” dialog (on top of the “Printer Setup” dialog in the figure). Here, specify the desired display in its lower field (:0 is the usual setting), and then click the “Browse” button to specify the directory location of the fonts you want to add.

Clicking “OK” brings you to the “Font” dialog (illustrated on the right in Figure Two). With this dialog, you can view the attributes of any font within the directory you specified earlier, modifying them if appropriate. The main purpose of this dialog, however, is to convert the font-metrics files into the format StarOffice understands. You can convert each font individually by selecting them one at a time and then clicking the “Convert Metric File” button (this makes sense only if you want to process just a subset of the fonts in the directory), or you can convert them all in one shot by using the “Convert All Metric Files” button.

Once the conversion process is complete, click “Close” to exit from this dialog. The font installation is now complete, and you may close the “Printer Installation” dialog as well. Restarting StarOffice will make the fonts available to its component applications.

As I’ve hinted, TrueType fonts pose a bit more of a problem with these two applications than Type 1 fonts. With Applixware, the best approach with TrueType fonts is simply to add them using the FontTastic font manager and live with the fact that they will print at 300 dpi.

If you want to use TrueType fonts with StarOffice, you can choose to convert them to Type 1, or you may use Ghostscript to do the font rendering for them. Obviously, this will require a version of Ghostscript that is built to support TrueType fonts. Even in the latter case, however, there are some additional steps required before StarOffice can print the fonts successfully. Specifically, you must create .afm files for the TrueType fonts, place them within the StarOffice directory tree (specifically, the xp3/fontmetrics/afm subdirectory), and add them to various StarOffice configuration files. The procedure for doing all of this is given in the StarOffice 5.1 Setup Guide.

Font Futures

Several projects are underway to make font management under X more straightforward. For example, the Definitive Type Manager (DTM) project is an attempt to automate several font-management procedures (see http://www.debian.org/~fog/dtm), although it is currently only in its earliest stages. (The gglyph utility is one front end to this and similar facilities; see http://aix2.uottawa.ca/~s1204672/linux/gglyph.)

The FreeType project, which provides a native TrueType font-rendering engine library for the X Window System, is much farther along. It is already used in some of the previously mentioned facilities, including xfsft.

In any case, the existence of these projects is cause for optimism, and the future should provide a great deal in the way of increased convenience for the system administrator when it comes to font management.

Font-Related Information and Resources

X Logical Font Description Conventions: On most systems, located in /usr/doc/XFree86-doc-3.3.5/XLFD

Fonts FAQ: http://www.nwalsh.com/comp.fonts/FAQ

Ghostscript: http://www.ghostscript.com (there are also some technical docs on most systems in /usr/doc/ghostview *)

TrueType HowTo: http://siva.usc.edu/~brion/linux/TrueType-HOWTO.html

FreeType Project: http://www.freetype.org/intro.html or http://www.freetype.org/old_index.html

Applixware font info: Chapter 3 of the Sys Admin online book (view via help system); see also http://members.bellatlantic.net/~smithrod/fonts.html

StarOffice font info: Star Office Setup Guide, pp. 42-49 (available on the CD: linuxdocumentationsetup.pdf; see also http://www.mindspring.net/~john_mcl/adding_fonts.html

GIMP Font Info: http://manual.gimp.org/manual/GUM/Fonts.html (chapter 46)

t1utils: http://www.lcdf.org/~eddietwo/type

gfontview: http://www.geocities.com/SiliconValley/Foothills/1458

t1lib (type1afm): http://www.neuroinformatik.ruhr-uni-bochum.de/ini/PEOPLE/rmz/t1lib/t1lib.html

xfsft: http://www.dcs.ed.ac.uk/home/jec/programs/xfsft

x-tt: http://X-TT.dsl.gr.jp

xfstt: http://metalab.unc.edu/pub/Linux/X11/fonts (for info see http://www.linuxgazette.com/issue28/ayers1.html)

ttf2pfa, ttf2pt1, tt1asm: http://www.netspace.net.au/~mheath/ttf2pt1

ttfutils: http://siva.usc.edu/~brion/linux/ttf.html

ttmkfdir: http://www.darmstadt.gmd.de/~pommnitz/TrueType/xfsft.html

Æleen Frisch is the author of O’Reilly & Associates’ Essential System Administration. She can be reached at [email protected].

Comments are closed.