dvips: Encodings
6.1.4 Encodings
---------------
Every font, whatever its type, has an "encoding", that specifies the
correspondence between "logical" characters and character codes. For
example, the ASCII encoding specifies that the character numbered 65
(decimal) is an uppercase 'A'. The encoding does not specify what the
character at that position looks like; there are lots of ways to draw an
'A', and a glyph file (⇒Glyph files) tells how. Nor does it
specify how much space that character occupies; that information is in a
metric file (⇒Metric files).
TeX implicitly assumes a particular encoding for the fonts you use
with it. For example, the plain TeX macro '\'', which typesets an acute
accent over the following letter, assumes the acute accent is at
position 19 (decimal). This happens to be true of standard TeX fonts
such as Computer Modern, as you might expect, but it is not true of
normal PostScript fonts.
It's possible but painful to change all the macros that assume
particular character positions. A better solution is to create a new
font with the information for the acute accent at position 19, where TeX
expects it to be. ⇒Making a font available.
PostScript represents encodings as a sequence of 256 character names
called an "encoding vector". An "encoding file" ('.enc') gives such a
vector, together with ligature and kerning information (with which we
are not concerned at the moment). These encoding files are used by the
Afm2tfm program. Encoding files are also downloaded to the PostScript
interpreter in your printer if you use one of them in place of the
default encoding vector for a particular PostScript font.
Examples of encodings: the 'dvips.enc' encoding file that comes with
the Fontname distribution (<http://tug.org/fontname>) is a good (but not
perfect) approximation to the TeX encoding for TeX's Computer Modern
text fonts. This is the encoding of the fonts that originated with
Dvips, such as 'ptmr.tfm'. The distribution includes many other
encoding files; for example, '8r.enc', which is the base font for the
current PostScript font distribution, and three corresponding to the TeX
mathematics fonts: 'texmext.enc' for math extensions, 'texmital.enc' for
math italics, and 'texmsym.enc' for math symbols.