Go to the first, previous, next, last section, table of contents.

How PostScript typesets a character

The output of Dvips is a program in the PostScript language that instructs your (presumably PostScript-capable) printer how to typeset your document by transforming it into toner on paper. Your printer, in turn, contains a PostScript interpreter that carries out the instructions in this typesetting program.

The program must include the definition of any PostScript fonts that you use in your document. Fonts built into your printer (probably the standard 35: `Times-Roman', `ZapfDingbats', ...) are defined within the interpreter itself. Other fonts must be downloaded as pfa or pfb files (see section Glyph files) from your host (the computer on which you're running Dvips).

You may be wondering exactly how a PostScript interpreter figures out what character to typeset, with this mass of metrics, glyphs, encodings, and other information. (If you're not wondering, skip this section ...)

The basic PostScript operator for imaging characters is show. Suppose you've asked TeX to typeset an `S'. This will eventually wind up in the Dvips output as the equivalent of this PostScript operation:

(S) show

Here is how PostScript typesets the `S':

  1. PostScript interpreters use ASCII; therefore `S' is represented as the integer 83. (Any of the 256 possible characters representable in a standard 8-bit byte can be typeset.)
  2. A PostScript dictionary is a mapping of names to arbitrary values. A font, to the interpreter, is a dictionary which contains entries for certain names. (If these entries are missing, the interpreter refuses to do anything with that font.) PostScript has a notion of "the current font"---whatever font is currently being typeset in.
  3. One of the mandatory entries in a font dictionary is `Encoding', which defines the encoding vector (see section Encodings) for that font. This vector of 256 names maps each possible input character to a name.
  4. The interpreter retrieves the entry at position 83 of the encoding vector. This value is a PostScript name: /S.
  5. For Type 1 fonts (we're not going to discuss anything else), the interpreter now looks up /S as a key in a dictionary named CharStrings, another mandatory entry in a font dictionary.
  6. The value of S in CharStrings is the equivalent of a series of standard PostScript commands like `curveto', `lineto', `fill', and so on. These commands are executed to draw the character. There can also be hint information that helps adapt the character to low-resolution rasters. (See section Glyph files.) The commands are actually represented in a more compact way than standard PostScript source; see the Type 1 book for details.

This method for typesetting characters is used in both Level 1 and Level 2 PostScript. See the PostScript reference manuals for more information.


Go to the first, previous, next, last section, table of contents.