Font Installation Examples for Linux and UNIX.
For this example Code 39 fonts are being used as a sample installation on Linux, but the installation instructions will be the same for any OS running the X11 window system (i.e. any modern UNIX). If a commercial UNIX (e.g. Solaris) is being used that includes Adobe’s Display Postscript System (DPS), it’ll include a utility for installing Type 1 fonts. Otherwise, the easiest way to add new fonts is to use the type1inst utility. If a commercial Linux distribution (e.g. Redhat) is being used, the utility is supplied with the distribution.
There are three main things that type1inst can do:
- Generate the “fonts.scale” file which X uses to pick up Type 1 fonts.
- Generate entries for fonts which can be inserted into Ghostscript’s “Fontmap” configuration file.
- Make font sample sheets.
To install the fonts, go through the following steps for each directory which have fonts to be used. (Note: log in as root to make these changes.)
- Unzip the *.afm and *.pfb files into a directory (this will be their permanent home). (X doesn’t use the AFM files, but other applications do.)
- cd to the directory.
- Run type1inst (see the included documentation). For font sample sheets, include the “-samples” switch before running it. It will create “fonts.dir” and “fonts.scale” files, and will complain that it can’t identify the type foundry (the Code39 fonts don’t contain this usual information in their headers). Edit the “fonts.dir” and “fonts.scale” files to change all occurrences of “unknown” to “advancements”.
- If this is the first time this directory has been use, the X server needs to know where it is located so that it can use the fonts. How this is accomplished depends on the mechanism by which the X server gets its fonts. In most cases the X server handles fonts itself, i.e. in the X server configuration there is information about which directories contain fonts which it can use. How this is done varies from implementation to implementation. If XFree86 is being used (under Linux, for instance), edit the “FontPath” entry in the “/etc/X11/XF86Config file” to add the new font directory. For other X implementations, consult the documentation on how to add directories to the X font path. The second (less common) way for the X server to obtain fonts is via an X font server, i.e. a machine running the program xfs. Note that xfs and the X server can be running on the same machine or on different machines over a network. Similar to the previous case of the X server which handles its own fonts, xfs needs to know where the new fonts are. The font path for xfs is listed in the “catalogue” section of its configuration file and this is where the new entry needs to be added. See the xfs(1) manual page for details.
- If fonts are being set up for use with Ghostscript (e.g. a non-Postscript printer is being used): A file called “Fontmap” is generated by type1inst in the current directory. Since Ghostscript has one global Fontmap file, use a text editor to cut and paste the entries from the local “Fontmap” into the global “Fontmap” (the location of this may vary, i.e. /usr/lib/ghostscript/5.10/Fontmap). Since the Fontmap entries do not contain information about which directory the fonts are installed in, add an entry to the GS_LIB environment variable which specifies the font directory. When Ghostscript, is next used these fonts will then be available.
- If a font sample sheet was generated: A new directory called “samples” will have been generated with a series of PostScript files in it. There is one file for each font in the directory plus some files called “allfonts-N.ps” (N is a digit) which are PostScript files containing smaller samples of text from ALL the fonts. The single font samples are named after the real name of the font, not the filename in which they are stored. For example, “samples/Code39HalfInch-Regular.ps” corresponds to the font file “c39half_.pfb”. There are a couple of very important points which must be made about the sample sheet feature. Firstly, sending any of these files to a PostScript printer, chances are the output was not as expected. Type1inst does not embed the fonts themselves into the sample file for the reason this would use up a large amount of disk space (and most probably, the fonts won’t be used regularly anyway). If Ghostscript has been setup to find the fonts as described previously then the files will be able to be viewed correctly if opened in Ghostview (or some other preview application based on Ghostscript). To print out the samples or view them with Ghostview on a machine where the fonts are not installed then use the t1embed script to insert the fonts in the sample file. Simply specify the filenames of the samples with embedded fonts as arguments to t1embed. The current version of t1embed requires that the fonts be embedded in the current directory (i.e. it won’t look in GS_LIB or the X font path for files). In normal usage run t1embed from the directory with the fonts in it.