Fonts and font facilities supplied with Ghostscript

Table of contents

For other information, see the Ghostscript overview.


About Ghostscript fonts

Ghostscript is distributed with two kinds of files related to fonts:

Additionally, the file cidfmap can be used to create substitutes for CIDFonts referenced by name in Postscript and PDF jobs. See the section on CID Font Substitution for details. NOTE: care must be exercised since poor or incorrect output may result from inappropriate CIDFont substitution. We therefore strongly recommend embedding CIDFonts in your Postscript and PDF files if at all possible.

The "base 35" fonts required for Postscript (and "base 14" required for PDF) are Postscript Type 1 font files.

When Ghostscript needs a font, it must have some way to know where to look for it: that's the purpose of the Fontmap file, which associates the names of fonts such as /Times-Roman with the names of font files, such as n021003l.pfb. Fontmap can also create aliases for font names, so that for instance, /NimbusNo9L-Regu means the same font as /Times-Roman.


Ghostscript's free fonts

How Ghostscript gets fonts when it runs

Fonts occupy about 50KB each, so Ghostscript doesn't load them all automatically when it runs. Instead, as part of normal initialization Ghostscript runs a file gs_fonts.ps, which arranges to load fonts on demand using information from the font map. To preload all of the known fonts, invoke the procedure

loadallfonts

The file lib/prfont.ps contains code to print a sample page of a font. Load this program by including it in the gs command line or by invoking

(prfont.ps) run

Then to produce a sampler of a particular font XYZ, invoke

/XYZ DoFont

For example,

/Times-Roman DoFont

For more information about how Ghostscript loads fonts during execution, see here.


Adding your own fonts

Ghostscript can use any Type 0, 1, 3, 4, or 42 font acceptable to other PostScript language interpreters or to ATM, including MultiMaster fonts. Ghostscript can also use TrueType font files.

To add fonts of your own, you must edit Fontmap to include at the end an entry for your new font; the format for entries is documented in Fontmap itself. Since later entries in Fontmap override earlier entries, a font you add at the end supersedes any corresponding fonts supplied with Ghostscript and defined earlier in the file. To ensure correct output, it is vital that entries for the "base 35" fonts remain intact in the Fontmap file.

In the PC world, Type 1 fonts are customarily given names ending in .PFA or .PFB. Ghostscript can use these directly: you just need to make the entry in Fontmap. If you want to use with Ghostscript a commercial Type 1 font (such as fonts obtained in conjunction with Adobe Type Manager), please read carefully the license that accompanies the font to satisfy yourself that you may do so legally; we take no responsibility for any possible violations of such licenses. The same applies to TrueType fonts.

Converting BDF fonts (- deprecated!)

Ghostscript provides a way to construct a (low-quality) Type 1 font from a bitmap font in the BDF format popular in the Unix world. The shell script bdftops (Unix) or the command file bdftops.bat (DOS) converts a BDF file to a scalable outline using bdftops.ps . Run the shell command

bdftops BDF_filename [AFM_file1_name ...] gsf_filename fontname
          UniqueID [XUID] [encodingname]

The arguments have these meanings:

BDF_filename    Input bitmap file in BDF format     
AFM_file1_name   AFM files giving metrics   (Optional)
gsf_filename   Output file    
fontname   Name of the font    
UniqueID   UniqueID (as described below)    
XUID   XUID, in the form n1.n2.n3... (as described below)   (Optional)
encodingname   "StandardEncoding" (the default), "ISOLatin1Encoding",
"SymbolEncoding", "DingbatsEncoding"
  (Optional)

For instance

bdftops pzdr.bdf ZapfDingbats.afm pzdr.gsf ZapfDingbats 4100000 1000000.1.41

Then make an entry in Fontmap for the .gsf file (pzdr.gsf in the example) as described above.


For developers only

The rest of this document is very unlikely to be of value to ordinary users.

Contents of fonts

As noted above, Ghostscript accepts fonts in the same formats as PostScript interpreters. Type 0, 1, and 3 fonts are documented in the PostScript Language Reference Manual (Second Edition); detailed documentation for Type 1 fonts appears in a separate Adobe book. Type 2 (compressed format) fonts are documented in separate Adobe publications. Type 4 fonts are not documented anywhere; they are essentially Type 1 fonts with a BuildChar or BuildGlyph procedure. Types 9, 10, and 11 (CIDFontType 0, 1, and 2) and Type 32 (downloaded bitmap) fonts are documented in Adobe supplements. Type 42 (encapsulated TrueType) fonts are documented in an Adobe supplement; the TrueType format is documented in publications available from Apple and Microsoft. Ghostscript does not support Type 14 (Chameleon) fonts, which use a proprietary Adobe format.

Font names and unique IDs

If you create your own fonts and will use them only within your own organization, you should use UniqueID values between 4000000 and 4999999.

If you plan to distribute fonts, ask Adobe to assign you some UniqueIDs and also an XUID for your organization. Contact

Unique ID Coordinator
Adobe Developers Association
Adobe Systems, Inc.
345 Park Avenue
San Jose, CA 95110-2704
+1-408-536-9000 telephone (ADA)
+1-408-536-6883 fax
fontdev-person@adobe.com

The XUID is a Level 2 PostScript feature that serves the same function as the UniqueID, but is not limited to a single 24-bit integer. The bdftops program creates XUIDs of the form "[-X- 0 -U-]" where "-X-" is the organization XUID and "-U-" is the UniqueID. (Aladdin Enterprises' organization XUID, which appears in a few places in various font-related files distributed with Ghostscript, is 107; do not use this for your own fonts that you distribute.)


Using Ghostscript fonts on X Windows displays

The "Xfonts" feature is no longer supported.


Copyright © 2000-2006 Artifex Software, Inc. All rights reserved.

This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that license. Refer to licensing information at http://www.artifex.com/ or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.

Ghostscript version 9.22, 4 October 2017