summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/make-tex-work/html/ch05.html
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-doc/doc/english/make-tex-work/html/ch05.html')
-rw-r--r--Master/texmf-doc/doc/english/make-tex-work/html/ch05.html3711
1 files changed, 3711 insertions, 0 deletions
diff --git a/Master/texmf-doc/doc/english/make-tex-work/html/ch05.html b/Master/texmf-doc/doc/english/make-tex-work/html/ch05.html
new file mode 100644
index 00000000000..ac0558358d6
--- /dev/null
+++ b/Master/texmf-doc/doc/english/make-tex-work/html/ch05.html
@@ -0,0 +1,3711 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta name="generator"
+ content="HTML Tidy for Linux/x86 (vers 1st March 2002), see www.w3.org" />
+ <meta http-equiv="Content-Type"
+ content="text/html; charset=ISO-8859-1" />
+
+ <title>Chapter&#160;5.&#160;Fonts</title>
+ <link rel="stylesheet" href="mtw.css" type="text/css" />
+ <meta name="generator"
+ content="DocBook XSL Stylesheets V1.53.0" />
+ <link rel="home" href="index.html" title="Making TeX Work" />
+ <link rel="up" href="pt02.html"
+ title="Part&#160;II.&#160;Elements of a Complex Document" />
+ <link rel="previous" href="pt02.html"
+ title="Part&#160;II.&#160;Elements of a Complex Document" />
+ <link rel="next" href="ch06.html"
+ title="Chapter&#160;6.&#160;Pictures and Figures" />
+ </head>
+
+ <body>
+ <div class="navheader">
+ <table border="0" cellpadding="0" cellspacing="0"
+ width="100%" summary="Navigation table">
+ <tr>
+ <td align="left">&#160;<a title="Making TeX Work"
+ href="index.html"><img src="figures/nav-home.png"
+ alt="Home" border="0" /></a>&#160;<a
+ title="Part&#160;II.&#160;Elements of a Complex Document"
+ href="pt02.html"><img src="figures/nav-prev.png"
+ alt="Prev" border="0" /></a>&#160;<a
+ title="Part&#160;II.&#160;Elements of a Complex Document"
+ href="pt02.html"><img src="figures/nav-up.png" alt="Up"
+ border="0" /></a>&#160;<a
+ title="Chapter&#160;6.&#160;Pictures and Figures"
+ href="ch06.html"><img src="figures/nav-next.png"
+ alt="Next" border="0" /></a></td>
+
+ <td align="right"><i>Making TeX Work</i> Version 1.0.1
+ <span class="alpha-version">(<a
+ href="co01.html"><em>Alpha</em></a>)</span></td>
+ </tr>
+ </table>
+ </div>
+
+ <div class="chapter">
+ <div class="titlepage">
+ <div>
+ <h2 class="title"><a id="chap.fonts"
+ name="chap.fonts"></a>Chapter&#160;5.&#160;Fonts</h2>
+ </div>
+
+ <div>
+ <p class="releaseinfo">$Revision: 1.1 $</p>
+ </div>
+
+ <div>
+ <p class="pubdate">$Date: 2002/08/23 14:31:13 $</p>
+ </div>
+ <hr class="component-separator" />
+ </div>
+
+ <p>All of the common TeX macro packages use the Computer
+ Modern fonts<a id="id2855980" class="indexterm"
+ name="id2855980"></a><a id="id2855984" class="indexterm"
+ name="id2855984"></a><a id="id2855991" class="indexterm"
+ name="id2855991"></a><a id="id2877438" class="indexterm"
+ name="id2877438"></a> by default. In fact, the Computer
+ Modern fonts are so frequently used in TeX documents that
+ some people believe they are <span
+ class="emphasis"><em>the</em></span> TeX fonts and that no
+ other options are available.</p>
+
+ <p>This is not the case. In fact, using different fonts in
+ TeX is quite easy. However, many interrelated font issues can
+ be quite complicated, and it is possible to do things that
+ make your documents print incorrectly (or make them
+ unprintable).</p>
+
+ <p>This chapter explores all of the issues related to fonts
+ and how these issues are resolved by a combination of font
+ files, TeX macros, DVI drivers, and careful planning. At a
+ high level, it works like this:</p>
+
+ <div class="orderedlist">
+ <ol type="1">
+ <li>
+ <p>TeX macros select a font (by assigning
+ \font\fontid=fonttfm). The macros may be very simple or
+ quite complex (as is the case in LaTeX's New Font
+ Selection Scheme).</p>
+ </li>
+
+ <li>
+ <p>TeX loads the metric information from
+ <tt>fonttfm.tfm</tt><a id="id2879938" class="indexterm"
+ name="id2879938"></a>. Many implementations of TeX look
+ for this file in the directories on the
+ <tt>TEXFONTS</tt> path. TeX cannot process your
+ document if it cannot find the <tt>TFM</tt> file<a
+ id="id2879967" class="indexterm"
+ name="id2879967"></a>.<sup>[<a id="id2879974"
+ name="id2879974"
+ href="#ftn.id2879974">53</a>]</sup></p>
+ </li>
+
+ <li>
+ <p>TeX writes a <tt>DVI</tt> file<a id="id2880010"
+ class="indexterm" name="id2880010"></a>. The
+ <tt>DVI</tt> file contains the name of each font (the
+ name of the <tt>TFM</tt> file) and the magnification
+ used (magnification is discussed in the section
+ &#8220;<a href="ch05.html#sec.issueofsize"
+ title="What TeX Needs To Know">the section called
+ &#8220;What TeX Needs To Know&#8221;</a>&#8221; later
+ in this chapter).</p>
+ </li>
+
+ <li>
+ <p>The DVI driver attempts to locate font files for
+ each font used at each magnification. Depending on the
+ DVI driver, fonts can come from many places. Many
+ drivers consult a list of built-in fonts to see if the
+ desired font resides in the printer. Some also consult
+ a list of font substitutions. (This can be used to
+ substitute existing fonts for fonts that you do not
+ have, like Computer Modern Roman in place of Times
+ Roman if you don't have Times Roman.)</p>
+
+ <p>Assuming that the font is not built-in<a
+ id="id2880077" class="indexterm" name="id2880077"></a>
+ or replaced by substitution of a built-in font, the DVI
+ driver looks for a font file. Most modern DVI drivers
+ look for <tt>PK</tt> fonts, although some also look for
+ <tt>GF</tt><a id="id2880109" class="indexterm"
+ name="id2880109"></a> and <tt>PXL</tt> fonts<a
+ id="id2880130" class="indexterm" name="id2880130"></a>
+ as well.</p>
+
+ <p>The exact location of these files varies. Some
+ implementations look in the directories on the
+ <tt>TEXFONTS</tt> path, others look in the
+ <tt>TEXPKS</tt> or <tt>PKFONTS</tt> paths.</p>
+
+ <p>A typical font directory on a unix system is
+ <tt>/usr/local/lib/tex/fonts/pk</tt>. The files in this
+ directory typically have names of the form
+ <tt>tfmname.999pk</tt>; where <span
+ class="emphasis"><em>tfmname</em></span> is the name of
+ the font and <span class="emphasis"><em>999</em></span>
+ is the resolution.</p>
+
+ <p>On file systems which have short filenames (for
+ example, MS-DOS) a typical font directory is <tt>\bs
+ tex\bs fonts\bs 999dpi</tt> (or <tt>\bs tex\bs fonts\bs
+ dpi999</tt>).<sup>[<a id="id2880211" name="id2880211"
+ href="#ftn.id2880211">54</a>]</sup> The files are then
+ simply <tt>tfmname.pk</tt>.</p>
+
+ <p>Some DVI drivers employ automatic font generation to
+ attempt to create the font if it cannot be found.</p>
+ </li>
+
+ <li>
+ <p>The DVI driver produces output suitable for a
+ particular device. This may include one or more forms
+ of downloaded fonts as well as requests for built-in
+ fonts that are assumed to exist.</p>
+ </li>
+ </ol>
+ </div>
+
+ <div class="note"
+ style="margin-left: 0.5in; margin-right: 0.5in;">
+ <h3 class="title">Note</h3>
+
+ <p>TeX output isn't printable directly. TeX typesets a
+ document in a device-independent fashion; it's the DVI
+ driver that actually <span
+ class="emphasis"><em>prints</em></span> the document. This
+ is important because many of the font issues are really DVI
+ driver issues more than TeX issues, and because the
+ distinction between TeXing a document and printing a
+ document is another layer of complexity that can be a
+ source of difficulty.,</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a
+ id="sec.issueofsize" name="sec.issueofsize"></a>What
+ TeX Needs To Know</h2>
+ </div>
+ </div>
+
+ <p>TeX needs remarkably little information about a font.
+ Recall from Chapter&#160;<a href="ch01.html"
+ title="Chapter&#160;1.&#160;The Big Picture">Chapter&#160;1</a>,
+ <span class="emphasis"><em><a href="ch01.html"
+ title="Chapter&#160;1.&#160;The Big Picture">Chapter&#160;1</a></em></span>,
+ that TeX typesets each page using &#8220;boxes<a
+ id="id2880323" class="indexterm" name="id2880323"></a> and
+ glue<a id="id2880331" class="indexterm"
+ name="id2880331"></a>.&#8221; In order to perform this
+ function, TeX needs to know only the size of each character
+ (its width, height, and depth)<a id="id2880343"
+ class="indexterm" name="id2880343"></a><a id="id2880353"
+ class="indexterm" name="id2880353"></a><a id="id2880362"
+ class="indexterm" name="id2880362"></a><a id="id2880372"
+ class="indexterm" name="id2880372"></a><a id="id2880382"
+ class="indexterm" name="id2880382"></a><a id="id2880389"
+ class="indexterm" name="id2880389"></a><a id="id2880397"
+ class="indexterm" name="id2880397"></a>. In practice, TeX
+ fonts contain a little bit more information than simply the
+ size of each character. Generally, they contain ligature
+ and kerning information as well.</p>
+
+ <p><span class="emphasis"><em>Ligatures</em></span><a
+ id="id2880416" class="indexterm" name="id2880416"></a> are
+ a typographic convention for replacing some letter
+ combinations with single symbols. In English, this is done
+ solely to improve the appearance of the letter
+ combinations. Figure&#160;<a href="ch05.html#fig.filig"
+ title="Figure&#160;5.1.&#160;fi as two characters and as a ligature">
+ Figure&#160;5.1</a> shows a common ligature in English,
+ &#8220;fi.&#8221; Other common ligatures in English are
+ &#8220;ff&#8221;, &#8220;fl&#8221;, and the combinations
+ &#8220;ffi&#8221; and &#8220;ffl.&#8221; Other languages
+ have different ligatures.</p>
+
+ <div class="figure">
+ <a id="fig.filig" name="fig.filig"></a>
+
+ <p class="title">
+ <b>Figure&#160;5.1.&#160;&#8220;fi&#8221; as two
+ characters and as a ligature</b></p>
+
+ <div class="mediaobject">
+ <img src="fi-ligs.eps" />
+ </div>
+ </div>
+
+ <p><span class="emphasis"><em>Kerning</em></span><a
+ id="id2880500" class="indexterm" name="id2880500"></a> is
+ the process of adding or removing small amounts of space
+ between characters to improve the appearance of particular
+ letter combinations. Although every character has a natural
+ width, some combinations of characters give the illusion of
+ too much or too little space. Figure&#160;<a
+ href="ch05.html#fig.kerning"
+ title="Figure&#160;5.2.&#160;We unkerned and kerned">Figure&#160;5.2</a>
+ shows a common example in the word &#8220;We.&#8221;</p>
+
+ <div class="figure">
+ <a id="fig.kerning" name="fig.kerning"></a>
+
+ <p class="title">
+ <b>Figure&#160;5.2.&#160;&#8220;We&#8221; unkerned and
+ kerned</b></p>
+
+ <div class="mediaobject">
+ <img src="we-we.eps" />
+ </div>
+ </div>
+
+ <p>This is all the information that TeX needs, and it is
+ all that is contained in the <tt>TFM</tt> files that TeX
+ uses.<sup>[<a id="id2880575" name="id2880575"
+ href="#ftn.id2880575">55</a>]</sup></p>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2880659"
+ name="id2880659"></a>Selecting a Font in TeX</h3>
+ </div>
+ </div>
+
+ <p>TeX's macro language includes a \font primitive for
+ loading a font<a id="id2880668" class="indexterm"
+ name="id2880668"></a><a id="id2880678" class="indexterm"
+ name="id2880678"></a><a id="id2880691" class="indexterm"
+ name="id2880691"></a>. This primitive operation
+ associates a control sequence<a id="id2880701"
+ class="indexterm" name="id2880701"></a> with the metrics
+ in a particular <tt>TFM</tt> file. For example, the
+ following line associates the control sequence \tinyfont
+ with the metrics in <tt>cmr5.tfm</tt> (the Computer
+ Modern Roman 5pt font):</p>
+<pre class="screen">
+\font\tinyfont=cmr5
+</pre>
+
+ <div class="note"
+ style="margin-left: 0.5in; margin-right: 0.5in;">
+ <h3 class="title">Note</h3>
+
+ <p>Remember, only letters can appear in a TeX control
+ sequence. You cannot say \font\cmr5=cmr5 because \cmr5
+ is not a valid control sequence.</p>
+ </div>
+
+ <p>The control sequence defined with \font can
+ subsequently be used to change the current font. After
+ the above command, \tinyfont in your document selects the
+ Computer Modern Roman 5pt font as the current font.</p>
+
+ <p>In practice, using the primitive operations to select
+ fonts has a number of disadvantages. Later in this
+ chapter, the worst of these disadvantages is described
+ and a better alternative is offered. For simplicity, the
+ primitive operations are used in most of the examples in
+ this chapter.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2880773"
+ name="id2880773"></a>Which Character Is Which?</h3>
+ </div>
+ </div>
+
+ <p>How does TeX know which character<a id="id2880782"
+ class="indexterm" name="id2880782"></a> to use when it
+ reads a symbol from an input file? The answer is simple:
+ TeX considers each font to be an array of characters. It
+ uses the numeric ASCII<a id="id2880794" class="indexterm"
+ name="id2880794"></a> code of each character to determine
+ what element in the array to use.<sup>[<a id="id2880810"
+ name="id2880810" href="#ftn.id2880810">56</a>]</sup> This
+ is a reasonable and efficient scheme as long as the ASCII
+ values of the characters in your input file are the same
+ as the metric information that TeX is using.</p>
+
+ <p>The section called &#8220;<a
+ href="ch05.html#sec.fonts.encodingvec"
+ title="Declaring a family">the section called
+ &#8220;Declaring a family&#8221;</a>&#8221; in this
+ chapter describes how the ordering of characters in a
+ font is determined. It also discusses some of the
+ problems that can arise when TeX and your printer have
+ conflicting information about the arrangement of
+ characters in the font. The &#8220;<a
+ href="ch05.html#sec.fonts.virtualfonts"
+ title="Virtual Fonts">the section called &#8220;Virtual
+ Fonts&#8221;</a>&#8221; section describes the TeX
+ mechanism for constructing fonts with different
+ arrangements of characters.</p>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a id="id2880909"
+ name="id2880909"></a>The Issue of Size</h2>
+ </div>
+ </div>
+
+ <p>In the purest sense, selecting a font determines only
+ what shape<a id="id2880917" class="indexterm"
+ name="id2880917"></a><a id="id2880921" class="indexterm"
+ name="id2880921"></a> each character will have; it does not
+ determine the size<a id="id2880932" class="indexterm"
+ name="id2880932"></a><a id="id2880939" class="indexterm"
+ name="id2880939"></a> of the font. Unfortunately in
+ practice, the issue of shape and size cannot be separated.
+ The same shapes <span
+ class="emphasis"><em>appear</em></span> to be different at
+ different sizes. <span class="emphasis"><em>Optical
+ scaling</em></span><a id="id2880960" class="indexterm"
+ name="id2880960"></a><a id="id2880967" class="indexterm"
+ name="id2880967"></a> uses different designs to make
+ letters at different sizes appear to have the same shape.
+ Conversly, linear scaling<a id="id2880980"
+ class="indexterm" name="id2880980"></a><a id="id2880987"
+ class="indexterm" name="id2880987"></a> produces characters
+ with exactly the same shape at different sizes, although
+ they appear slightly different.</p>
+
+ <p>Because the size of an object affects the way that the
+ human eye and the brain perceive its shape, a simple linear
+ scaling of each character does not produce the most
+ aesthetically pleasing results. To overcome this problem,
+ TeX uses two different quantities to express the notion of
+ size: design size and magnification.</p>
+
+ <p><span class="emphasis"><em>Design size</em></span><a
+ id="id2881047" class="indexterm" name="id2881047"></a>
+ addresses the issue of perception: a font looks most like
+ the way it was designed to appear when printed at or close
+ to its design size. Furthermore, two fonts with different
+ design sizes (say 8pt and 12pt) that are the same typeface
+ should <span class="emphasis"><em>appear</em></span>
+ identical when printed at 8pt and 12pt, respectively, even
+ though the actual shapes may be slightly different. The
+ design size of a font is intrinsic to the font itself and
+ cannot be changed or influenced by TeX. It is important
+ because it has a direct impact on the aesthetics of the
+ typeset page.</p>
+
+ <p><span class="emphasis"><em>Magnification</em></span><a
+ id="id2881075" class="indexterm" name="id2881075"></a>
+ addresses the notion of linear scaling. Changing
+ magnifications changes the size of each character without
+ altering its actual shape. Although, as noted above,
+ changing its size may change its <span
+ class="emphasis"><em>apparent</em></span> shape. In
+ general, you should print fonts as close to their design
+ size as possible---in other words, with a magnifcation as
+ close to 1.0 as possible. Figure&#160;<a
+ href="ch05.html#fig.Rs"
+ title="Figure&#160;5.3.&#160;The Computer Modern Roman letter R at 150pt: (a) from a 5pt design; (b) from a 17pt design">
+ Figure&#160;5.3</a> demonstrates how different characters
+ may look when printed at very large magnifications.</p>
+
+ <div class="figure">
+ <a id="fig.Rs" name="fig.Rs"></a>
+
+ <p class="title"><b>Figure&#160;5.3.&#160;The Computer
+ Modern Roman letter &#8220;R&#8221; at 150pt: (a) from a
+ 5pt design; (b) from a 17pt design</b></p>
+
+ <div class="mediaobject">
+ <img src="two-rs.eps" />
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="sec.gettingtfms"
+ name="sec.gettingtfms"></a>Expressing Design Size in
+ TeX</h3>
+ </div>
+ </div>
+
+ <p>The design size<a id="id2881175" class="indexterm"
+ name="id2881175"></a> of a font is an integral part of
+ the <tt>TFM</tt> file (because it is intrinsic to the
+ font that the <tt>TFM</tt> file<a id="id2881207"
+ class="indexterm" name="id2881207"></a> describes). In
+ order to select a different design size, you must select
+ a different <tt>TFM</tt> file. For example, the Computer
+ Modern Roman font is usually distributed at eight design
+ sizes: 5, 6, 7, 8, 9, 10, 12, and 17 points. Metrics for
+ these sizes are stored in the <tt>TFM</tt> files
+ <tt>cmr5.tfm</tt>, <tt>cmr6.tfm</tt>, <tt>cmr7.tfm</tt>,
+ $&#8230;$, and <tt>cmr17.tfm</tt>.</p>
+
+ <p>Every font that you select has a specific design size,
+ even though you may elect to use the font at another
+ size.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2881284"
+ name="id2881284"></a>Expressing Magnification in
+ TeX</h3>
+ </div>
+ </div>
+
+ <p>Magnification<a id="id2881294" class="indexterm"
+ name="id2881294"></a> can be expressed either implicitly
+ or explicitly in TeX. Implicitly, magnification can be
+ expressed by selecting a particular font <tt>at</tt> a
+ particular size. For example, the following line defines
+ the control sequence \big to be the Computer Modern Roman
+ 10pt font <tt>at</tt> a size of 12pt (an implicit
+ magnification of 120\%):</p>
+<pre class="screen">
+\font\big=cmr10 at 12pt
+</pre>
+
+ <p>Explicit magnification is selected by requesting a
+ font <tt>scaled</tt> to a particular extent. For example,
+ the following line defines the control sequence \bigger
+ to be the Computer Modern Roman 10pt font at a
+ magnification of 144\% (in other words, at 14.4pt):</p>
+<pre class="screen">
+\font\bigger=cmr10 scaled 1440
+</pre>
+
+ <p>As you can see, TeX expects the <tt>scaled</tt>
+ magnification to be ten times the percentage of
+ magnification. The magnification that you request must be
+ an integer (you can't say <tt>scaled 1440.4</tt>).
+ Multiplying the magnification by 10 allows TeX to accept
+ fractional percentages like 104.5\%.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2881380"
+ name="id2881380"></a>Standard Magnifications</h3>
+ </div>
+ </div>
+
+ <p>TeX provides seven standard magnifications. There are
+ several good reasons to use these magnifications whenever
+ possible. The most important is that most TeX systems can
+ easily print fonts at these sizes. As described later in
+ the section &#8220;<a href="ch08.html#sec.printing"
+ title="Printing Fonts">the section called &#8220;Printing
+ Fonts&#8221;</a>,&#8221; TeX's ability to select any font
+ at any magnification does not guarantee that it can be
+ printed at that size. By using standard sizes, you
+ increase the likelihood that your document will be
+ printable on your system and on other TeX systems (if
+ portability is an issue). Using standard sizes will also
+ give consistency to your documents. If you write many
+ documents separately that may eventually be collected
+ together (as a collection of short stories or a series of
+ technical reports, for example), the internal consistency
+ of sizes will make them appear more uniform. Finally, the
+ standard sizes have aesthetic characteristics as well.
+ Each size is 1.2 times the preceding size. The geometric
+ relationship between the sizes is designed to make them
+ appear pleasing when mixed together.</p>
+
+ <p>The standard sizes can be selected with the \magstep
+ control sequence. The standard sizes (or steps) are
+ called <span class="emphasis"><em>magsteps</em></span> in
+ TeX jargon. The natural size of a font is its \magstep0
+ size. The \magstep1 size is 20\% larger. And \magstep2 is
+ 20\% larger than that (44\% larger than the original
+ design), etc. To select the Computer Modern Roman 10pt
+ font at its next largest standard size, use:</p>
+<pre class="screen">
+\font\larger=cmr10 scaled\magstep1
+</pre>
+
+ <p>For those occasions when you want a font that is only
+ a little bit larger, TeX includes the control sequence
+ \magstephalf which is halfway between \magstep0 and
+ \magstep1.</p>
+
+ <p>Most TeX formats that are based upon Plain TeX define
+ seven magsteps: \magstep0, \magstephalf, and \magstep1
+ through \magstep5.</p>
+
+ <p>By using different design sizes and different standard
+ magnifications, you gain access to a very wide range of
+ sizes. For example, given the seven standard design sizes
+ and seven standard magsteps, it is possible to print
+ Computer Modern Roman at any of the following sizes (all
+ sizes are in points):</p>
+
+ <table class="simplelist" border="0"
+ summary="Simple list">
+ <tr>
+ <td>5</td>
+
+ <td>7.67</td>
+
+ <td>9.6</td>
+
+ <td>10.95</td>
+
+ <td>13.15</td>
+
+ <td>16.59</td>
+
+ <td>19.91</td>
+
+ <td>29.38</td>
+ </tr>
+
+ <tr>
+ <td>5.48</td>
+
+ <td>8</td>
+
+ <td>9.86</td>
+
+ <td>11.52</td>
+
+ <td>13.82</td>
+
+ <td>17</td>
+
+ <td>20.4</td>
+
+ <td>29.86</td>
+ </tr>
+
+ <tr>
+ <td>6</td>
+
+ <td>8.4</td>
+
+ <td>10</td>
+
+ <td>12</td>
+
+ <td>14.4</td>
+
+ <td>17.28</td>
+
+ <td>20.74</td>
+
+ <td>35.25</td>
+ </tr>
+
+ <tr>
+ <td>6.57</td>
+
+ <td>8.64</td>
+
+ <td>10.08</td>
+
+ <td>12.1</td>
+
+ <td>14.52</td>
+
+ <td>17.42</td>
+
+ <td>22.39</td>
+
+ <td>42.3</td>
+ </tr>
+
+ <tr>
+ <td>7</td>
+
+ <td>8.76</td>
+
+ <td>10.37</td>
+
+ <td>12.44</td>
+
+ <td>14.93</td>
+
+ <td>18.62</td>
+
+ <td>24.48</td>
+
+ <td>7.2</td>
+ </tr>
+
+ <tr>
+ <td>9</td>
+
+ <td>10.8</td>
+
+ <td>12.96</td>
+
+ <td>15.55</td>
+
+ <td>18.66</td>
+
+ <td>24.88</td>
+
+ <td>&#160;</td>
+
+ <td>&#160;</td>
+ </tr>
+ </table>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2881671"
+ name="id2881671"></a>Where Do TFM Files Come
+ From?</h3>
+ </div>
+ </div>
+
+ <p>In order to use <span
+ class="emphasis"><em>any</em></span> font in TeX, you
+ must have a <tt>TFM</tt> file for it. How you can acquire
+ <tt>TFM</tt> files<a id="id2881705" class="indexterm"
+ name="id2881705"></a> for the fonts you use depends on
+ the kinds of fonts and where they were developed. The
+ following list offers suggestions for the most commonly
+ used fonts:</p>
+
+ <div class="variablelist">
+ <dl>
+ <dt><span class="term">PostScript fonts</span></dt>
+
+ <dd>
+ <p>Every vendor that supplies PostScript fonts<a
+ id="id2881738" class="indexterm"
+ name="id2881738"></a><a id="id2881748"
+ class="indexterm" name="id2881748"></a> (either as
+ font files or built-in to a printer or cartridge)
+ should also supply Adobe Font Metric (<tt>AFM</tt>)
+ files. <tt>AFM</tt> files provide complete metric
+ information about the fonts.<sup>[<a id="id2881782"
+ name="id2881782"
+ href="#ftn.id2881782">57</a>]</sup> The
+ <tt>AFM</tt> files can be converted into
+ <tt>TFM</tt> files with the <b>afm2tfm</b> utility
+ distributed with <b>dvips</b>.</p>
+ </dd>
+
+ <dt><span class="term">LaserJet built-in
+ fonts</span></dt>
+
+ <dd>
+ <p>The complete metric information for LaserJet
+ built-in fonts<a id="id2881868" class="indexterm"
+ name="id2881868"></a> is supplied by
+ Hewlett-Packard in &#8220;Tagged Font Metric&#8221;
+ files. These are available directly from
+ Hewlett-Packard (unfortunately, they are not
+ distributed with the printers). The Tagged Font
+ Metrics can be converted into TeX <tt>TFM</tt>
+ files with <b>hptfm2pl</b>, a free utility written
+ by, well, me, actually.</p>
+
+ <p>A collection of <tt>TFM</tt> files for the
+ standard built-in fonts on the LaserJet III and IV
+ printers is available in the CTAN archives in
+ <tt>/tex-archive/fonts/ljmetrics</tt>.</p>
+ </dd>
+
+ <dt><span class="term">LaserJet softfonts</span></dt>
+
+ <dd>
+ <p>Bitmapped LaserJet softfonts<a id="id2881950"
+ class="indexterm" name="id2881950"></a> can be
+ converted into TeX fonts with the <b>SFPtoPK</b><a
+ id="id2881968" class="indexterm"
+ name="id2881968"></a> utility. The resulting font
+ includes both TeX <tt>PK</tt> and <tt>TFM</tt>
+ files.</p>
+
+ <p>Scalable LaserJet softfonts should be
+ distributed with Hewlett-Packard Tagged Font Metric
+ files. These can be converted into TeX <tt>TFM</tt>
+ files with the free utility <b>hptfm2pl</b><a
+ id="id2882018" class="indexterm"
+ name="id2882018"></a>.</p>
+ </dd>
+
+ <dt><span class="term">TeX fonts
+ (<span>MetaFont</span>)</span></dt>
+
+ <dd>
+ <p>The MetaFont<a id="id2882052" class="indexterm"
+ name="id2882052"></a> program renders TeX
+ <tt>MF</tt> files<a id="id2882076"
+ class="indexterm" name="id2882076"></a> and
+ produces a <tt>TFM</tt> file. Usually it produces a
+ <tt>GF</tt> file<a id="id2882115" class="indexterm"
+ name="id2882115"></a> as well, but the special mode
+ <span class="emphasis"><em>tfmonly</em></span> can
+ be used to create just the <tt>TFM</tt>
+ file.<sup>[<a id="id2882138" name="id2882138"
+ href="#ftn.id2882138">58</a>]</sup> MetaFont modes
+ and other aspects of font creation with MetaFont
+ are described in Chapter&#160;<a href="ch11.html"
+ title="Chapter&#160;11.&#160;Introducing MetaFont">Chapter&#160;11</a>,
+ <span class="emphasis"><em><a href="ch11.html"
+ title="Chapter&#160;11.&#160;Introducing MetaFont">Chapter&#160;11</a></em></span>.</p>
+ </dd>
+
+ <dt><span class="term">TrueType fonts</span></dt>
+
+ <dd>
+ <p>Incomplete metrics are frequently<a
+ id="id2882219" class="indexterm"
+ name="id2882219"></a> distributed in the form of
+ Windows' <tt>PFM</tt> files<a id="id2882240"
+ class="indexterm" name="id2882240"></a>. Some
+ commercial previewers for Windows can extract
+ metric information and build a <tt>TFM</tt> file.
+ However, at present, I do not know of any free
+ utilities which can build TeX metrics from TrueType
+ fonts.</p>
+ </dd>
+ </dl>
+ </div>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a id="sec.nfss2"
+ name="sec.nfss2"></a>The New Font Selection Scheme</h2>
+ </div>
+ </div>
+
+ <p>The New Font Selection Scheme<a id="id2882292"
+ class="indexterm" name="id2882292"></a> is a method for
+ selecting fonts in Plain TeX and LaTeX. It was introduced
+ briefly in the section &#8220;<a
+ href="ch04.html#macpack.sec.latexvslatexe"
+ title="Installation: Making Format Files">the section
+ called &#8220;Installation: Making Format
+ Files&#8221;</a>&#8221; of Chapter&#160;<a href="ch04.html"
+ title="Chapter&#160;4.&#160;Macro Packages">Chapter&#160;4</a>,
+ <span class="emphasis"><em><a href="ch04.html"
+ title="Chapter&#160;4.&#160;Macro Packages">Chapter&#160;4</a></em></span>.
+ This section describes release two of the New Font
+ Selection Scheme (known as the NFSS2)<a id="id2882340"
+ class="indexterm" name="id2882340"></a> as it exists in the
+ LaTeX2e format. Because version one<a id="id2882349"
+ class="indexterm" name="id2882349"></a> is now obsolete, it
+ is not described.</p>
+
+ <p>The NFSS defines a method of font selection used in
+ place of TeX's primitive \font command. The problem with
+ font selection using \font is that it ties a control
+ sequence to a particular font at a particular size, which
+ has unpleasant consequences when more than one font is used
+ in a document. Consider the definition \font\it=cmti10.
+ This associates the control sequence \it with the italic
+ Computer Modern font (at 10pt). After this definition, a
+ sentence like:</p>
+<pre class="screen">
+This requires <span class="emphasis"><em>emphasis</em></span>.
+</pre>
+
+ <p>has the desired result, if Computer Modern Roman at 10pt
+ is the font in use when \it is encountered:</p>
+<pre class="screen">
+\fontfamily{cmr}\selectfont
+This requires <span class="emphasis"><em>emphasis</em></span>.
+</pre>
+
+ <p>If you are using some other font, perhaps in a chapter
+ heading, you get:</p>
+<pre class="screen">
+\fontfamily{cmr}\fontseries{bx}\fontsize{14}{16pt}\selectfont
+This requires {\fontfamily{cmr}\fontseries{m}\fontsize{10}{12pt}\selectfont
+\it emphasis}.
+</pre>
+
+ <p>This is almost certainly not what you wanted. The NFSS
+ overcomes this difficulty by describing each font with five
+ independent parameters: encoding, family, series, shape,
+ and size.</p>
+
+ <div class="variablelist">
+ <dl>
+ <dt><span class="term">Font encoding</span></dt>
+
+ <dd>
+ <p>The encoding<a id="id2882449" class="indexterm"
+ name="id2882449"></a> parameter identifies the
+ encoding vector of the font. Encoding vectors play an
+ important role in the selection of characters in a
+ font. Encoding vectors are described more thoroughly
+ later in this chapter. TeX Text, TeX Math Italic, and
+ Adobe Standard are all <span
+ class="emphasis"><em>encoding vectors</em></span><a
+ id="id2882461" class="indexterm"
+ name="id2882461"></a>.</p>
+ </dd>
+
+ <dt><span class="term">Font family</span></dt>
+
+ <dd>
+ <p>The family parameter describes the typeface of the
+ font<a id="id2882492" class="indexterm"
+ name="id2882492"></a>. Computer Modern, Times Roman,
+ Helvetica, Galliard, and Gill Sans are all <span
+ class="emphasis"><em>families</em></span>.</p>
+ </dd>
+
+ <dt><span class="term">Font series</span></dt>
+
+ <dd>
+ <p>Font series<a id="id2882523" class="indexterm"
+ name="id2882523"></a> describes the joint notions of
+ weight and width. Weight<a id="id2882533"
+ class="indexterm" name="id2882533"></a> is a measure
+ of how darkly each character is printed, and width<a
+ id="id2882543" class="indexterm"
+ name="id2882543"></a> is a measure of how wide or
+ narrow the font is. Standard abbreviations for weight
+ and width are shown in Table&#160;<a
+ href="ch05.html#tab.fontshapeww"
+ title="Table&#160;5.1.&#160;Standard Weight and Width Designations ">
+ Table&#160;5.1</a>. Normal, bold-compressed,
+ extrabold-ultraexpanded, and light-medium are all
+ examples of font <span
+ class="emphasis"><em>series</em></span>.</p>
+
+ <div class="table">
+ <a id="tab.fontshapeww" name="tab.fontshapeww"></a>
+
+ <p class="title"><b>Table&#160;5.1.&#160;Standard
+ Weight and Width Designations</b></p>
+
+ <table
+ summary="Standard Weight and Width Designations "
+ border="1">
+ <colgroup>
+ <col align="left" />
+ <col align="left" />
+ <col align="left" />
+ <col align="left" />
+ <col align="left" />
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th align="left">\rm\bf Abbr</th>
+
+ <th align="left">\bf Weight</th>
+
+ <th align="left">\rm\bf Abbr</th>
+
+ <th align="left">\bf Width</th>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td align="left">ul</td>
+
+ <td align="left">Ultra-light</td>
+
+ <td align="left">uc</td>
+
+ <td align="left">Ultra-condensed</td>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+
+ <tr>
+ <td align="left">el</td>
+
+ <td align="left">Extra-light</td>
+
+ <td align="left">ec</td>
+
+ <td align="left">Extra-condensed</td>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+
+ <tr>
+ <td align="left">l</td>
+
+ <td align="left">Light</td>
+
+ <td align="left">c</td>
+
+ <td align="left">Condensed</td>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+
+ <tr>
+ <td align="left">sl</td>
+
+ <td align="left">Semi-light</td>
+
+ <td align="left">sc</td>
+
+ <td align="left">Semi-condensed</td>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+
+ <tr>
+ <td align="left">m</td>
+
+ <td align="left">Medium (normal)</td>
+
+ <td align="left">m</td>
+
+ <td align="left">Medium</td>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+
+ <tr>
+ <td align="left">sb</td>
+
+ <td align="left">Semi-bold</td>
+
+ <td align="left">sx</td>
+
+ <td align="left">Semi-expanded</td>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+
+ <tr>
+ <td align="left">b</td>
+
+ <td align="left">Bold</td>
+
+ <td align="left">x</td>
+
+ <td align="left">Expanded</td>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+
+ <tr>
+ <td align="left">eb</td>
+
+ <td align="left">Extra-bold</td>
+
+ <td align="left">ex</td>
+
+ <td align="left">Extra-expanded</td>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+
+ <tr>
+ <td align="left">ub</td>
+
+ <td align="left">Ultra-bold</td>
+
+ <td align="left">ux</td>
+
+ <td align="left">Ultra-expanded</td>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <p>The general rule for combining weight and width to
+ form a series abbreviation is to use the abbreviation
+ for weight followed by the abbreviation for width,
+ unless one is &#8220;medium,&#8221; in which case it
+ is left out. Table&#160;<a
+ href="ch05.html#tab.fontshapeex"
+ title="Table&#160;5.2.&#160;Weight and Width Are Combined to Form Series ">
+ Table&#160;5.2</a> shows how several weight/width
+ combinations are used to form the series. The series
+ designation for a light-medium font demonstrates that
+ a single medium attribute is omitted. If both the
+ width and weight are medium, use a single
+ &#8220;m&#8221; for the series.</p>
+
+ <div class="table">
+ <a id="tab.fontshapeex" name="tab.fontshapeex"></a>
+
+ <p class="title"><b>Table&#160;5.2.&#160;Weight and
+ Width Are Combined to Form Series</b></p>
+
+ <table
+ summary="Weight and Width Are Combined to Form Series "
+ border="1">
+ <colgroup>
+ <col align="left" />
+ <col align="left" />
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th align="left">\bf Weight and Width</th>
+
+ <th align="left">\bf Series</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td align="left">Bold extended</td>
+
+ <td align="left">bx</td>
+ </tr>
+
+ <tr>
+ <td align="left">Light medium</td>
+
+ <td align="left">l</td>
+ </tr>
+
+ <tr>
+ <td align="left">Medium extra-expanded</td>
+
+ <td align="left">ex</td>
+ </tr>
+
+ <tr>
+ <td align="left">Light extra-expanded</td>
+
+ <td align="left">lex</td>
+ </tr>
+
+ <tr>
+ <td align="left">Normal (medium, medium)</td>
+
+ <td align="left">m</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </dd>
+
+ <dt><span class="term">Font shape</span></dt>
+
+ <dd>
+ <p>The shape<a id="id2883001" class="indexterm"
+ name="id2883001"></a>, in conjunction with series,
+ defines the appearance of the font. Shape generally
+ refers to the style of the face. Bold, italic,
+ slanted, and outline are all examples of font
+ shape.</p>
+
+ <p>The standard designations of font shape are shown
+ in Table&#160;<a href="ch05.html#tab.fontshapeshape"
+ title="Table&#160;5.3.&#160;Standard Abbreviations of Font Shape">
+ Table&#160;5.3</a>.</p>
+
+ <div class="table">
+ <a id="tab.fontshapeshape"
+ name="tab.fontshapeshape"></a>
+
+ <p class="title"><b>Table&#160;5.3.&#160;Standard
+ Abbreviations of Font Shape</b></p>
+
+ <table
+ summary="Standard Abbreviations of Font Shape"
+ border="1">
+ <colgroup>
+ <col align="left" />
+ <col align="left" />
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th align="left">\rm\bf Abbr.</th>
+
+ <th align="left">\bf Shape</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td align="left">n</td>
+
+ <td align="left">Normal</td>
+ </tr>
+
+ <tr>
+ <td align="left">it</td>
+
+ <td align="left">Italic</td>
+ </tr>
+
+ <tr>
+ <td align="left">sl</td>
+
+ <td align="left">Slanted</td>
+ </tr>
+
+ <tr>
+ <td align="left">sc</td>
+
+ <td align="left">Small caps</td>
+ </tr>
+
+ <tr>
+ <td align="left">u</td>
+
+ <td align="left">Upright italics</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </dd>
+
+ <dt><span class="term">Font size</span></dt>
+
+ <dd>
+ <p>Font size<a id="id2883162" class="indexterm"
+ name="id2883162"></a> defines both the size of the
+ characters and the spacing between lines of text in
+ that size. The distinction between design size and
+ magnification, discussed at length in the first part
+ of this chapter, is hidden within the NFSS; you need
+ only select the size you want.<sup>[<a id="id2883176"
+ name="id2883176"
+ href="#ftn.id2883176">59</a>]</sup></p>
+
+ <p>The spacing between lines of text is described as
+ the (vertical) distance between the baselines of two
+ consecutive lines of type. It is usually about 20\%
+ larger than the size of the font. For example, a 10pt
+ font is usually printed with 12pts between the
+ baselines of consecutive lines. The inter-line
+ distance that looks best depends on the font and
+ other design elements of the document. There really
+ isn't a good rule for the value that looks best,
+ which is why you have to specify it.</p>
+ </dd>
+ </dl>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="sec.fonts.defnfss2"
+ name="sec.fonts.defnfss2"></a>Selecting Fonts with
+ the New Font Selection Scheme</h3>
+ </div>
+ </div>
+
+ <p>One of the most visible differences in the NFSS2 is
+ that you are encouraged to change the way you select<a
+ id="id2883229" class="indexterm" name="id2883229"></a>
+ fonts. The NFSS2 defines nine control sequences<a
+ id="id2883241" class="indexterm" name="id2883241"></a>
+ for user-level font selection. They are shown in
+ Table&#160;<a href="ch05.html#tab.nfss2.userlevel"
+ title="Table&#160;5.4.&#160;User-level Font Selection Control Sequences in NFSS2 ">
+ Table&#160;5.4</a>.</p>
+
+ <div class="table">
+ <a id="tab.nfss2.userlevel"
+ name="tab.nfss2.userlevel"></a>
+
+ <p class="title"><b>Table&#160;5.4.&#160;User-level
+ Font Selection Control Sequences in NFSS2</b></p>
+
+ <table
+ summary="User-level Font Selection Control Sequences in NFSS2 "
+ border="1">
+ <colgroup>
+ <col align="left" />
+ <col align="left" />
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th align="left">\bf Control Sequence</th>
+
+ <th align="left">\bf Resulting Change</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td align="left">\textrm\verb|{}|</td>
+
+ <td align="left">Switch to roman family</td>
+ </tr>
+
+ <tr>
+ <td align="left">\textsf\verb|{}|</td>
+
+ <td align="left">Switch to sans-serif family</td>
+ </tr>
+
+ <tr>
+ <td align="left">\texttt\verb|{}|</td>
+
+ <td align="left">Switch to typewriter family</td>
+ </tr>
+
+ <tr>
+ <td align="left">\textbf\verb|{}|</td>
+
+ <td align="left">Switch to bold face
+ weight/width</td>
+ </tr>
+
+ <tr>
+ <td align="left">\textmedium\verb|{}|</td>
+
+ <td align="left">Switch to medium
+ weight/width</td>
+ </tr>
+
+ <tr>
+ <td align="left">\textit\verb|{}|</td>
+
+ <td align="left">Switch to italic shape</td>
+ </tr>
+
+ <tr>
+ <td align="left">\textsl\verb|{}|</td>
+
+ <td align="left">Switch to slanted shape</td>
+ </tr>
+
+ <tr>
+ <td align="left">\textsc\verb|{}|</td>
+
+ <td align="left">Switch to small-caps shape</td>
+ </tr>
+
+ <tr>
+ <td align="left">\emph\verb|{}|</td>
+
+ <td align="left">Switch to emphasized text</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <p>Instead of using \it, for example, to change to an
+ italic font within a group, you should use the \textit
+ command with the text as an argument. For example,
+ instead of using:</p>
+<pre class="screen">
+This is some <span class="emphasis"><em>italic</em></span> text.
+</pre>
+
+ <p>you should use:</p>
+<pre class="screen">
+This is some <span class="emphasis"><em>italic</em></span> text.
+</pre>
+
+ <p>The advantage of the new scheme is that these macros
+ are much more intelligent than the old ones. Notice that
+ I did not specify italic correction () in the second
+ case. This is because the \textit macro is able to
+ determine if the correction is necessary, and if so,
+ inserts it automatically.\ff{If you wish to suppress
+ italic correction, use \cs{nocorr} at the end (or
+ beginning) of the text.} The macros can also be
+ nested.</p>
+
+ <p>The NFSS2 allows you to use the old font selection
+ macros, so existing documents will not be affected. If
+ you want to set several paragraphs in a different font,
+ you should continue to use the old selection macros
+ because you cannot pass more than one paragraph of text
+ to a macro.\ff[2]{It is possible to write macros that
+ accept multiple paragraphs of text, but the NFSS2 font
+ selection macros do not do so.}</p>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h4 class="title"><a id="id2883502"
+ name="id2883502"></a>Low-level interface to
+ NFSS</h4>
+ </div>
+ </div>
+
+ <p>The user-level font selection commands are
+ implemented in terms of six low-level commands. At this
+ level, you must specify the encoding, family, series,
+ shape, and size of the font in order to select it.
+ There are six control sequences for selecting a font:
+ one each for specifying the font parameters and one for
+ actually switching to the new font. This strategy
+ allows the parameters to be independent; any parameters
+ that you do not explicitly change remain the same as
+ the current font.</p>
+
+ <p>These six control sequences are:</p>
+
+ <div class="variablelist">
+ <dl>
+ <dt><span
+ class="term">\fontencoding{<i><tt>enc</tt></i>}</span></dt>
+
+ <dd>
+ <p>Selects the encoding scheme
+ \textit<tt>enc</tt><a id="id2883556"
+ class="indexterm" name="id2883556"></a>. The
+ encoding schemes officially supported by the
+ NFSS2 are shown in Table&#160;<a
+ href="ch05.html#tab.nfss2.encoding"
+ title="Table&#160;5.5.&#160;Encoding Schemes Supported by NFSS2">
+ Table&#160;5.5</a>.</p>
+
+ <div class="table">
+ <a id="tab.nfss2.encoding"
+ name="tab.nfss2.encoding"></a>
+
+ <p class="title">
+ <b>Table&#160;5.5.&#160;Encoding Schemes
+ Supported by NFSS2</b></p>
+
+ <table
+ summary="Encoding Schemes Supported by NFSS2"
+ border="1">
+ <colgroup>
+ <col align="left" />
+ <col align="left" />
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th align="left">\bf Encoding</th>
+
+ <td class="auto-generated">&#160;</td>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td align="left">\bf Scheme</td>
+
+ <td align="left">\bf Encoding Name</td>
+ </tr>
+
+ <tr>
+ <td align="left">T1</td>
+
+ <td align="left">TeX text Cork
+ encoding</td>
+ </tr>
+
+ <tr>
+ <td align="left">OT1</td>
+
+ <td align="left">Old TeX text encoding
+ (the CMR encoding)</td>
+ </tr>
+
+ <tr>
+ <td align="left">OT2</td>
+
+ <td align="left">University of Washington
+ Cyrillic encoding</td>
+ </tr>
+
+ <tr>
+ <td align="left">OT3</td>
+
+ <td align="left">University of Washington
+ IPA encoding</td>
+ </tr>
+
+ <tr>
+ <td align="left">OML</td>
+
+ <td align="left">TeX math (italic)
+ letters</td>
+ </tr>
+
+ <tr>
+ <td align="left">OMS</td>
+
+ <td align="left">TeX math symbols</td>
+ </tr>
+
+ <tr>
+ <td align="left">OMX</td>
+
+ <td align="left">TeX math extended</td>
+ </tr>
+
+ <tr>
+ <td align="left">U</td>
+
+ <td align="left">Unknown encoding</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </dd>
+
+ <dt><span
+ class="term">\fontfamily{<i><tt>fam</tt></i>}</span></dt>
+
+ <dd>
+ <p>Selects the family \textit<tt>fam</tt>.</p>
+ </dd>
+
+ <dt><span
+ class="term">\fontseries{<i><tt>ser</tt></i>}</span></dt>
+
+ <dd>
+ <p>Selects the series \textit<tt>ser</tt>.</p>
+ </dd>
+
+ <dt><span
+ class="term">\fontshape{<i><tt>shp</tt></i>}</span></dt>
+
+ <dd>
+ <p>Selects the shape \textit<tt>shp</tt>.</p>
+ </dd>
+
+ <dt><span
+ class="term">\fontsize{<i><tt>ptsize</tt></i>}{<i><tt>
+ bskip</tt></i>}</span></dt>
+
+ <dd>
+ <p>Selects the font size \textit<tt>ptsize</tt>
+ with a distance of \textit<tt>bskip</tt> between
+ lines. Note that \textit<tt>ptsize</tt> is a
+ simple number, whereas \textit<tt>bskip</tt> is a
+ TeX distance and you must specify units after the
+ number. Under the NFSS2, \textit<tt>ptsize</tt>
+ specifies the <span
+ class="emphasis"><em>actual</em></span> size of
+ the font,\ff{Under the NFSS1, the
+ \textit{\texttt{ptsize}} was simply a label; the
+ actual font loaded was the nearest magstep.} but
+ the NFSS2 will attempt to find a closest match if
+ there is no exact match for the requested size. A
+ warning message is issued if the size does not
+ exist and a closest match has to be selected. You
+ can control the sensitivity of the warning with
+ the \fontsubfuzz parameter. It is initially set
+ to 0.4pt, meaning that any font within 0.4pt of
+ the requested size will be used without issuing a
+ warning.</p>
+ </dd>
+
+ <dt><span class="term">\selectfont</span></dt>
+
+ <dd>
+ <p>Switches to the font described by the current
+ values of encoding, family, series, shape, and
+ size.</p>
+ </dd>
+ </dl>
+ </div>
+
+ <p>From this description, can you figure out how the
+ control sequence <span
+ class="emphasis"><em>could</em></span> be defined under
+ the NFSS? See this footnote<sup>[<a id="id2855832"
+ name="id2855832" href="#ftn.id2855832">60</a>]</sup>
+ for the answer.</p>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2855857"
+ name="id2855857"></a>Defining Fonts with NFSS2</h3>
+ </div>
+ </div>
+
+ <p>The standard Computer Modern fonts and most PostScript
+ fonts can be selected by using the appropriate style
+ files or inputting the appropriate macros. However, if
+ you have nonstandard fonts or fonts for some other
+ device, you can easily add them to the NFSS<a
+ id="id2855870" class="indexterm"
+ name="id2855870"></a>.</p>
+
+ <p>The internal interface to the NFSS has been entirely
+ redesigned. The new interface is much cleaner than the
+ interface to the NFSS1, but similar in design.</p>
+
+ <p>If you are not very familiar with TeX, what follows
+ may be a bit confusing; treat this example as a sort of
+ &#8220;cookbook recipe&#8221; and substitute the font you
+ wish to define for the <tt>logo</tt> font (the
+ <tt>logo</tt> font is the typeface used for the MetaFont
+ logo).</p>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h4 class="title"><a id="sec.fonts.encodingvec"
+ name="sec.fonts.encodingvec"></a>Declaring a
+ family</h4>
+ </div>
+ </div>
+
+ <p>In order to add a new typeface, you must declare a
+ new font family<a id="id2855932" class="indexterm"
+ name="id2855932"></a> with the control sequence
+ \DeclareFontFamily. If you are only adding new sizes or
+ shapes to an existing family, do not redeclare the
+ family.</p>
+
+ <p>The parameters to \DeclareFontFamily are the
+ encoding, name, and loading options for the family.
+ Loading options are any commands that should be
+ executed every time this family is selected. For most
+ fonts, there are no loading options.<sup>[<a
+ id="id2855948" name="id2855948"
+ href="#ftn.id2855948">61</a>]</sup></p>
+
+ <p>The following declaration creates the <span
+ class="emphasis"><em>logo</em></span> family with the
+ old TeX encoding and no loading options:</p>
+<pre class="screen">
+\DeclareFontFamily{OT1}{logo}{}
+</pre>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h4 class="title"><a id="id2884256"
+ name="id2884256"></a>Declaring shapes</h4>
+ </div>
+ </div>
+
+ <p>After a family has been created, you must specify
+ what font shapes<a id="id2884266" class="indexterm"
+ name="id2884266"></a> are available with
+ \DeclareFontShape. To make the font usable, you must
+ declare at least one font shape for each family.</p>
+
+ <p>The general form of a call to \DeclareFontShape
+ is:</p>
+<pre class="screen">
+\DeclareFontShape{<i><tt>enc</tt></i>}
+ {<i><tt>fam</tt></i>}
+ {<i><tt>series</tt></i>}
+ {<i><tt>shape</tt></i>}
+ {<i><tt>sizes</tt></i>}
+ {<i><tt>loading options</tt></i>}
+</pre>
+
+ <p>The family <tt><i><tt>fam</tt></i></tt> (with the
+ appropriate encoding <tt><i><tt>enc</tt></i></tt>) must
+ already have been created with \DeclareFontFamily. The
+ <tt><i><tt>series</tt></i></tt> and
+ <tt><i><tt>shape</tt></i></tt> parameters identify the
+ name of the series and shape. Table&#160;<a
+ href="ch05.html#tab.fontshapeex"
+ title="Table&#160;5.2.&#160;Weight and Width Are Combined to Form Series ">
+ Table&#160;5.2</a> and Table&#160;<a
+ href="ch05.html#tab.fontshapeshape"
+ title="Table&#160;5.3.&#160;Standard Abbreviations of Font Shape">
+ Table&#160;5.3</a> list some common series and shapes.
+ The \textit<tt>sizes</tt> parameter is a list of <span
+ class="emphasis"><em>font-shape
+ declarations</em></span>, described below, and the
+ \textit<tt>loading options</tt>, if specified, override
+ the loading options for the font family.</p>
+
+ <p>Each font-shape declaration indicates how the
+ request for a font should be handled. The complete
+ syntax for font-shape declarations is described in
+ <span class="emphasis"><em>Interface Description of
+ NFSS2</em></span>&#160;[<a
+ href="bi01.html#nfss2interface">nfss2interface</a>].
+ Here we look at three simple cases: substituting
+ another font for the one requested, generating the name
+ of the <tt>TFM</tt> file for the requested font, and
+ identifying a particular <tt>TFM</tt> file for a size
+ or range of sizes. Each of these techniques is used in
+ the declaration of the medium, normal logo font in
+ Example&#160;<a href="ch05.html#ex.logoshape"
+ title="Example&#160;5.1.&#160;Font-shape Declaration with NFSS2">
+ Example&#160;5.1</a>. There should be no extra spaces
+ in the font size parameter. If you spread it over
+ multiple lines in your input file, make sure that a
+ comment character (\%) appears at the end of each
+ line.</p>
+
+ <div class="example">
+ <a id="ex.logoshape" name="ex.logoshape"></a>
+
+ <p class="title"><b>Example&#160;5.1.&#160;Font-shape
+ Declaration with NFSS2</b></p>
+<pre class="screen">
+\DeclareFontShape{OT1}{logo}{m}{n}{
+ &lt;-8&gt;sub * cmr/m/n
+ &lt;8&gt;&lt;9&gt;&lt;10&gt;gen * logo
+ &lt;10.95&gt;logo10 at 10.95pt
+ &lt;12-&gt;logo10}{}
+</pre>
+ </div>
+
+ <p>Each font-shape declaration begins with one or more
+ size<a id="id2884513" class="indexterm"
+ name="id2884513"></a> specifications in angle brackets.
+ This indicates either a specific size
+ (<tt>&lt;10&gt;</tt> for a 10pt font) or a range of
+ sizes (<tt>&lt;8-9&gt;</tt> for any size larger than or
+ equal to 8pt and less than 9pt, <tt>&lt;-8&gt;</tt> for
+ all sizes less than 8pt, or <tt>&lt;10-&gt;</tt> for
+ all sizes larger than or equal to 10pt).</p>
+
+ <p>In Example&#160;<a href="ch05.html#ex.logoshape"
+ title="Example&#160;5.1.&#160;Font-shape Declaration with NFSS2">
+ Example&#160;5.1</a>, the first font-shape declaration
+ indicates that font substitution should be performed
+ for any request at a size smaller than 8pt. The string
+ <tt>cmr/m/n</tt> indicates that medium, normal,
+ Computer Modern Roman should be substituted in its
+ place. In general, the substitution specifies the
+ <tt><i><tt>family</tt></i>/<i><tt>shape</tt></i>/<i><tt>
+ series</tt></i></tt> to be substituted.</p>
+
+ <p>The second declaration indicates that the name of
+ the external font for 8pt, 9pt and 10pt fonts should be
+ generated from the string <tt>logo</tt> and the size
+ (at 8pt, <tt>logo8</tt> will be used; at 9pt,
+ <tt>logo9</tt>; and at 10pt, <tt>logo10</tt>).</p>
+
+ <p>The third declaration demonstrates that the font
+ specified (<tt>{logo10 at 10.95pt}</tt>) can be any
+ valid TeX font selection command. After special
+ declarations have been processed (substitution,
+ generation, etc.), the remaining declaration text is
+ passed to the TeX \font primitive.</p>
+
+ <p>The last declaration specifies that <span
+ class="emphasis"><em>any</em></span> size larger than
+ 12pt is valid. Any size larger than 12pt will use the
+ font <tt>logo10</tt>, scaled appropriately. Automatic
+ font generation, if it is being used, can take care of
+ actually generating the font. Example&#160;<a
+ href="ch05.html#ex.logoshape"
+ title="Example&#160;5.1.&#160;Font-shape Declaration with NFSS2">
+ Example&#160;5.1</a> was constructed to demonstrate
+ several features of the font-shape declaration syntax.
+ A simpler, more likely declaration for the medium
+ normal logo font is shown in Example&#160;<a
+ href="ch05.html#ex.logoshape2"
+ title="Example&#160;5.2.&#160;Font-shape declaration with NFSS2 (simplified)">
+ Example&#160;5.2</a>.</p>
+
+ <div class="example">
+ <a id="ex.logoshape2" name="ex.logoshape2"></a>
+
+ <p class="title"><b>Example&#160;5.2.&#160;Font-shape
+ declaration with NFSS2 (simplified)</b></p>
+<pre class="screen">
+\DeclareFontShape{OT1}{logo}{m}{n}{
+ &lt;-8&gt;sub * cmr/m/n
+ &lt;8-9&gt;logo8
+ &lt;9-10&gt;logo9
+ &lt;10-&gt;logo10}{}
+</pre>
+ </div>
+
+ <p>The 8pt design could have been scaled down for sizes
+ less than 8pt, but you should try to avoid large
+ deviations from the design size. Because the design for
+ my book does not require the logo font at sizes less
+ than 8pt, substitution was the best choice.<sup>[<a
+ id="id2884721" name="id2884721"
+ href="#ftn.id2884721">62</a>]</sup></p>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2884733"
+ name="id2884733"></a>Storing Font Definitions</h3>
+ </div>
+ </div>
+
+ <p>The NFSS will load your font definitions automatically
+ if you store them<a id="id2884743" class="indexterm"
+ name="id2884743"></a> in <tt>FD</tt> files<a
+ id="id2884764" class="indexterm" name="id2884764"></a> in
+ a directory where TeX looks for input files. Whenever an
+ unknown encoding/family is requested, NFSS attempts to
+ load the file <tt>encfamily.fd</tt>. For example, if the
+ font declarations described in the preceding sections are
+ stored in a file called <tt>OT1logo.fd</tt>, nothing
+ special has do be done to use the logo family. The first
+ time the logo family is selected, the definitions will be
+ read from <tt>OT1logo.fd</tt>.</p>
+
+ <p>If you are using LaTeX2e (or LaTeX with the NFSS),
+ there must already be a large number of <tt>FD</tt> files
+ on your system. For more information about building the
+ LaTeX2e format (which includes the NFSS2), consult the
+ section &#8220;<a href="ch04.html#sec.buildlatexe"
+ title="Building the LaTeX2e format">the section called
+ &#8220;Building the LaTeX2e format&#8221;</a>&#8221; in
+ Chapter&#160;<a href="ch04.html"
+ title="Chapter&#160;4.&#160;Macro Packages">Chapter&#160;4</a>,
+ <span class="emphasis"><em><a href="ch04.html"
+ title="Chapter&#160;4.&#160;Macro Packages">Chapter&#160;4</a></em></span>.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2884863"
+ name="id2884863"></a>Changing the Defaults</h3>
+ </div>
+ </div>
+
+ <p>Sometimes you want the fonts that you define to
+ replace the standard Computer Modern fonts. This is
+ easily accomplished. The NFSS defines control sequences<a
+ id="id2884874" class="indexterm" name="id2884874"></a>
+ which identify the default fonts. These control sequences
+ are listed in Table&#160;<a
+ href="ch05.html#tab.nfssdefaults"
+ title="Table&#160;5.6.&#160;Default Fonts ">Table&#160;5.6</a>.</p>
+
+ <div class="table">
+ <a id="tab.nfssdefaults" name="tab.nfssdefaults"></a>
+
+ <p class="title"><b>Table&#160;5.6.&#160;Default
+ Fonts</b></p>
+
+ <table summary="Default Fonts " border="1">
+ <colgroup>
+ <col align="left" />
+ <col align="left" />
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th align="left">\bf Control Sequence</th>
+
+ <th align="left">\bf Font</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td align="left">\rmdefault</td>
+
+ <td align="left">The default normal (roman)
+ font</td>
+ </tr>
+
+ <tr>
+ <td align="left">\bfdefault</td>
+
+ <td align="left">The default boldface font</td>
+ </tr>
+
+ <tr>
+ <td align="left">\sfdefault</td>
+
+ <td align="left">The default sans-serif font</td>
+ </tr>
+
+ <tr>
+ <td align="left">\itdefault</td>
+
+ <td align="left">The default italic font</td>
+ </tr>
+
+ <tr>
+ <td align="left">\scdefault</td>
+
+ <td align="left">The default caps and small-caps
+ font.</td>
+ </tr>
+
+ <tr>
+ <td align="left">\defaultshape</td>
+
+ <td align="left">The default shape
+ (<tt>n</tt>)</td>
+ </tr>
+
+ <tr>
+ <td align="left">\defaultseries</td>
+
+ <td align="left">The default series
+ (<tt>m</tt>)</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <p>If you have defined a new font, perhaps
+ <tt>garamond</tt> as I did for this book, you can make it
+ the default normal font by changing \rmdefault. In LaTeX,
+ the following command makes <tt>garamond</tt> the default
+ normal font:</p>
+<pre class="screen">
+\renewcommand{\rmdefault}{garamond}
+</pre>
+
+ <p>In Plain TeX, it's written like this:</p>
+<pre class="screen">
+\def\rmdefault{garamond}
+</pre>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2885098"
+ name="id2885098"></a>NFSS Pitfalls</h3>
+ </div>
+ </div>
+
+ <p>Defining your own fonts with the NFSS is
+ straightforward, but it is not without its subtleties.
+ There are several things going on behind the scenes that
+ you must be aware of if you are going to define your own
+ fonts.</p>
+
+ <p>The first consideration is font substitution. When
+ NFSS cannot find a font, it tries to substitute a
+ different one. First, it tries to find the font you
+ requested in the default shape, then in the default
+ series, and finally, in the default family. You can
+ change the defaults used by NFSS2 with the
+ \DeclareFontSubstitution command:</p>
+<pre class="screen">
+\DeclareFontSubstitution{<span
+class="emphasis"><em>encoding</em></span>}{<span
+class="emphasis"><em>family</em></span>}{<span
+class="emphasis"><em>series</em></span>}{<span
+class="emphasis"><em>shape</em></span>}
+</pre>
+
+ <p>You must specify the defaults for each encoding you
+ use because the encoding is never substituted.</p>
+
+ <p>The next consideration is the use of mathematics<a
+ id="id2885156" class="indexterm" name="id2885156"></a><a
+ id="id2885166" class="indexterm" name="id2885166"></a>,
+ which is typeset using an entirely different set of
+ fonts. Even if you don't use any math in your document,
+ the NFSS is prepared to function in math-mode at a
+ moment's notice. In order to be prepared, it has to know
+ what fonts to use. Ordinarily, mathematics is typeset
+ using fonts at the same size as the current text font.
+ This means that every time you change font sizes for
+ text, NFSS changes font sizes for mathematics as
+ well.</p>
+
+ <p>By default, the NFSS defines math fonts<a
+ id="id2885191" class="indexterm" name="id2885191"></a><a
+ id="id2885198" class="indexterm" name="id2885198"></a>
+ only at the following sizes: 5, 6, 7, 8, 9, 10, 11, 12,
+ 14, 17, 20, and 25pt. If you define a new font at a
+ different size, 24pt for example, the first time you try
+ to use that font, you will get several warning messages
+ indicating that <tt>cmr/m/n/24</tt> (Computer Modern
+ Roman), <tt>cmm/m/it/24</tt> (Computer Modern Math
+ Italic), <tt>cmsy/m/n/24</tt> (Computer Modern Math
+ Symbols), and <tt>lasy/m/n/24</tt> (LaTeX Symbols, if
+ using LaTeX), are not available. This is very confusing
+ because it won't appear that you have selected 24pt
+ Computer Modern <span
+ class="emphasis"><em>anywhere</em></span> in your
+ document.</p>
+
+ <p>There are two ways to solve this problem:<sup>[<a
+ id="id2885254" name="id2885254"
+ href="#ftn.id2885254">63</a>]</sup></p>
+
+ <div class="itemizedlist">
+ <ul type="disc">
+ <li>
+ <p>Redefine the required fonts at the sizes
+ requested. This involves copying the definition of
+ each of the fonts from NFSS <tt>FD</tt> files<a
+ id="id2885284" class="indexterm"
+ name="id2885284"></a> and adding new sizes.</p>
+ </li>
+
+ <li>
+ <p>Tell NFSS to use existing math sizes for the new
+ text sizes that you define. This option is
+ reasonable only if you won't be using any math at
+ the new sizes (or the sizes are so close that the
+ mathematics doesn't appear disproportional). NFSS
+ includes a macro called \DeclareMathSizes for this
+ purpose. Insert it directly after the
+ \DeclareFontShape command that declares the new
+ font sizes. You must call \DeclareMathSizes once
+ for each new size. For example, to use the 25pt
+ math sizes with 24pt text, insert the following
+ control sequence after you define the 24pt
+ font:</p>
+<pre class="screen">
+\DeclareMathSizes{25}{24}{20}{17}
+</pre>
+
+ <p>The general form of a call to \DeclareMathSizes
+ is:</p>
+<pre class="screen">
+\DeclareMathSizes{<span class="emphasis"><em>text-size</em></span>}
+ <tt>{</tt><span
+class="emphasis"><em>math-size</em></span><tt>}</tt>
+ <tt>{</tt><span
+class="emphasis"><em>script-size</em></span><tt>}</tt>
+ <tt>{</tt><span
+class="emphasis"><em>script-script-size</em></span><tt>}</tt>
+</pre>
+
+ <p>Where <span
+ class="emphasis"><em><tt>math-size</tt></em></span>,
+ <span
+ class="emphasis"><em><tt>script-size</tt></em></span>,
+ and <span
+ class="emphasis"><em><tt>script-script-size</tt></em></span>
+ are the normal (123), script ($x^{123}$), and
+ script-script ($x^{y^{123}}$) math sizes for the
+ specified <span
+ class="emphasis"><em><tt>text-size</tt></em></span>.</p>
+ </li>
+ </ul>
+ </div>
+
+ <p>LaTeX sometimes resets the current font to the
+ \rmdefault font. For example, it does this when a \ref is
+ going to be printed. This means that the font you define
+ as the \rmdefault font should be available in every size
+ that you use. This may require redefining the Computer
+ Modern Roman font, as described above, if you add a new
+ size but leave Computer Modern as the default font.</p>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a id="id2885459"
+ name="id2885459"></a>PostScript Fonts Under NFSS</h2>
+ </div>
+ </div>
+
+ <p>PostScript fonts<a id="id2885469" class="indexterm"
+ name="id2885469"></a><a id="id2885481" class="indexterm"
+ name="id2885481"></a> and other scalable font technologies
+ like TrueType differ from the way the
+ &#8220;standard&#8221; TeX fonts work. They do not separate
+ the notions of design size and magnification. Instead,
+ PostScript fonts can be rendered at <span
+ class="emphasis"><em>any</em></span> size from a single
+ design. In daily use, the PostScript fonts under NFSS are
+ indistinguishable from non-PostScript fonts. The NFSS
+ distribution includes style files for accessing the 35
+ standard PostScript fonts.</p>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2885510"
+ name="id2885510"></a>Adjustments to Scale</h3>
+ </div>
+ </div>
+
+ <p><a id="id2885518" class="indexterm"
+ name="id2885518"></a>Some combinations of PostScript
+ fonts, particularly PostScript fonts with Computer Modern
+ mathematics, look bad because there is a large
+ discrepancy between the apparent sizes of the fonts. For
+ example, as a consequence of design, 10pt Helvetica looks
+ bigger than 10pt Computer Modern Math Italic. In order to
+ correct this problem, you can specify a scaling factor
+ when declaring PostScript fonts.<sup>[<a id="id2885536"
+ name="id2885536" href="#ftn.id2885536">64</a>]</sup> The
+ scaling factor is specified in square brackets at the
+ beginning of the font-shape declaration in the
+ \DeclareFontShape command.</p>
+
+ <p>The easiest way to find an approximation of the
+ correct scaling factor is to look at the <span
+ class="emphasis"><em>x-height</em></span> of each
+ font.<sup>[<a id="id2885557" name="id2885557"
+ href="#ftn.id2885557">65</a>]</sup> The x-height is the
+ height of a lowercase &#8220;x&#8221; in the font. The
+ following macro will print the x-height of a font:</p>
+<pre class="screen">
+\def\showxheight#1{
+ \font\fontfoo=#1 at 10pt
+ \message{The x-height of #1 at 10pt is \the\fontdimen5\fontfoo}}
+</pre>
+
+ <p>The following TeX input will print the x-heights of
+ Helvetica and Computer Modern Roman (assuming that your
+ Helvetica font is called <tt>phvr</tt>):</p>
+<pre class="screen">
+\input showxheight
+\showxheight{phvr}
+\showxheight{cmr10}
+\bye
+</pre>
+
+ <p>On my system, the x-height of Helvetica is 5.23pt and
+ the x-height of Computer Modern Roman is 4.30554pt. The
+ following font declaration makes Helvetica have the same
+ apparent size as Computer Modern Roman:</p>
+<pre class="screen">
+\DeclareFontShape{OT1}{phv}{m}{n}{
+ &lt;-&gt; [0.8232] phvr}{}
+</pre>
+
+ <p>Compare scaled Helvetica to unscaled Helvetica:</p>
+
+ <p>FIXME: Unscaled Helvetica, Computer Modern Roman,
+ Scaled Helvetica</p>
+
+ <p>Unscaled Helvetica looks much larger than Computer
+ Modern, but the scaled Helvetica appears a little too
+ small. Experimentation is the only way to find the scale
+ that looks best.</p>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a id="id2885640"
+ name="id2885640"></a>When Things Go Wrong</h2>
+ </div>
+ </div>
+
+ <p>A number of font-related problems can arise<a
+ id="id2885650" class="indexterm" name="id2885650"></a>
+ which either prevent you from formatting and printing your
+ document or cause the output to differ from what you
+ anticipated. The following sections describe many common
+ problems and their solutions.</p>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2885669"
+ name="id2885669"></a>When TeX Complains</h3>
+ </div>
+ </div>
+
+ <p>The first time an error can occur is when TeX is
+ processing your document. Some of these errors prevent
+ TeX from continuing while others are simply warnings.</p>
+
+ <div class="variablelist">
+ <dl>
+ <dt><span class="term"><tt>! Font \myfont=xxxxx not
+ loadable: Metric (TFM) file not
+ found.</tt></span></dt>
+
+ <dd>
+ <p>This error indicates that TeX tried to process a
+ \font control sequence which assigned the font
+ <tt>xxxxx</tt> to the control sequence \myfont, but
+ TeX could not find a <tt>TFM</tt> file for the font
+ <tt>xxxxx</tt>. All the characters from the missing
+ font will be blank in the resulting <tt>DVI</tt>
+ file.</p>
+
+ <p>You cannot process your document until this
+ error is corrected, which is a matter of fixing the
+ offending \font command if you are using the old
+ font selection scheme.</p>
+
+ <p>Under the NFSS2, this error occurs if you
+ specify an invalid font in the command
+ \DeclareFontShape. Examine the font that you were
+ attempting to select and make sure that it
+ exists.</p>
+ </dd>
+
+ <dt><span class="term"><tt>Warning Font/shape `x/y/z'
+ undefined on input line
+ <i><tt>n</tt></i></tt></span></dt>
+
+ <dd>
+ <p>This is a warning message from the NFSS. It
+ indicates that you requested the font family
+ <tt>x</tt>, series <tt>y</tt>, and shape
+ <tt>z</tt>, but the requested font does not exist.
+ This message is followed by another indicating
+ which font NFSS chose to substitute in place of the
+ one you requested. NFSS substitutes the closest
+ possible font to the one you requested. It is
+ usually an acceptable replacement.</p>
+
+ <p>For example, if you are currently using Computer
+ Modern Bold Extended and you select Computer Modern
+ Typewriter, the NFSS will report that there is no
+ bold-extended-typewriter font and that normal
+ typewriter is being substituted in its place.</p>
+ </dd>
+
+ <dt><span class="term"><tt>! Font x/y/z/999 not
+ found.</tt></span></dt>
+
+ <dd>
+ <p>This is a fatal error from the NFSS. It
+ indicates that you selected font family <tt>x</tt>,
+ series <tt>y</tt>, shape <tt>z</tt> at a size of
+ 999pts and that no such font exists. This error
+ occurs when the size 999 is not defined in the
+ \DeclareFontShape command for x/y/z.</p>
+ </dd>
+
+ <dt><span class="term"><tt>Missing character: There
+ is no X in font foo!</tt></span></dt>
+
+ <dd>
+ <p>This is a warning message from TeX. Usually it
+ occurs only in the log file. This error occurs when
+ you attempt to access a character that does not
+ exist in the current font. This can happen if you
+ select the wrong font or if the selected font has a
+ different encoding vector than anticipated. See the
+ section &#8220;<a
+ href="ch05.html#sec.fonts.encodingvec"
+ title="Declaring a family">the section called
+ &#8220;Declaring a family&#8221;</a>&#8221; in this
+ chapter for more information.</p>
+ </dd>
+ </dl>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2885907"
+ name="id2885907"></a>When the DVI Driver
+ Complains</h3>
+ </div>
+ </div>
+
+ <p>Getting TeX to successfully produce a <tt>DVI</tt>
+ file<a id="id2885925" class="indexterm"
+ name="id2885925"></a> is only half the battle. The next
+ hurdle is getting a DVI driver to print it. Here are some
+ of the things that can go wrong:</p>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h4 class="title"><a id="id2885937"
+ name="id2885937"></a>Can't find PK file</h4>
+ </div>
+ </div>
+
+ <p>When a DVI driver complains that it cannot find the
+ appropriate <tt>PK</tt> file, there are several things
+ that could be wrong.</p>
+
+ <div class="itemizedlist">
+ <ul type="disc">
+ <li>
+ <p>The font is built into the printer.</p>
+
+ <p>If the DVI driver complains that it cannot
+ find the <tt>PK</tt> file for a built-in font,
+ you need to adjust the DVI driver's configuration
+ to indicate that the font is built-in. Exactly
+ how this is done depends on the DVI driver that
+ you are using. For example, if you are using
+ <b>dvips</b>, add an entry to the
+ <tt>psfonts.map</tt> file<a id="id2886005"
+ class="indexterm" name="id2886005"></a>. If you
+ are using emTeX, add an entry to the font
+ substitution file specified in the configuration
+ file. Consult the references for your particular
+ DVI driver for more information about using
+ built-in fonts.</p>
+ </li>
+
+ <li>
+ <p>The font does not exist on the printer you are
+ using.</p>
+
+ <p>This is the same problem as the error above
+ except that it cannot be fixed. For example, I
+ have <tt>TFM</tt> files for many PostScript fonts
+ at home because it helps me format bits of
+ documentation that I bring home from work without
+ error. However, if I try to print one of these
+ documents without first changing the fonts, the
+ DVI driver complains that it cannot find several
+ fonts. There is no way that I can correct this
+ because the missing fonts are built-in fonts for
+ a printer that I do not have at home. In this
+ case, font substitution by the DVI driver may
+ allow you to preview (and even print) the
+ document, but it won't look very good unless the
+ font metrics of the substituted font are very
+ close to the metrics for the original.</p>
+ </li>
+
+ <li>
+ <p>Uncommon size or font (no <tt>PK</tt>
+ file).</p>
+
+ <p>The Computer Modern family contains a number
+ of fonts that are very rarely used. If you don't
+ keep <tt>PK</tt> files for these fonts around all
+ the time and attempt to use one of them (or
+ attempt to use a common font at a very unusual
+ size), the DVI driver will not be able to find
+ the necessary <tt>PK</tt> file. You have to build
+ the <tt>PK</tt> file first. Consult
+ Chapter&#160;<a href="ch11.html"
+ title="Chapter&#160;11.&#160;Introducing MetaFont">
+ Chapter&#160;11</a> for more information about
+ building <tt>PK</tt> files with MetaFont. Also
+ consult the section called &#8220;<a
+ href="ch05.html#sec.autofont"
+ title="Automatic Font Generation by DVI Drivers">the
+ section called &#8220;Automatic Font Generation
+ by DVI Drivers&#8221;</a>&#8221; later in this
+ chapter.</p>
+ </li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h4 class="title"><a id="id2886152"
+ name="id2886152"></a>Accents don't work or the
+ wrong characters are printed</h4>
+ </div>
+ </div>
+
+ <p>This problem is usually caused by a bad encoding
+ vector. See the section &#8220;<a
+ href="ch05.html#sec.fonts.encodingvec"
+ title="Declaring a family">the section called
+ &#8220;Declaring a family&#8221;</a>&#8221; in this
+ chapter for more information.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h4 class="title"><a id="id2886177"
+ name="id2886177"></a>Printer prints the right
+ characters but the wrong font</h4>
+ </div>
+ </div>
+
+ <p>This is usually an indication that you are trying to
+ use a font that does not exist on the printer.
+ PostScript printers, for example, substitute Courier
+ for any font that does not exist.</p>
+
+ <p>Another possibility is that you have configured your
+ DVI driver incorrectly. I once told <b>dvips</b> to
+ download Galliard when I used Garamond. It took me
+ quite a while to find that error. Make sure that the
+ printer contains the fonts that you think it does and
+ make sure that you are mapping the TeX font names to
+ the correct printer fonts.</p>
+ </div>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a id="id2886211"
+ name="id2886211"></a>Encoding Vectors</h2>
+ </div>
+ </div>
+
+ <p>An encoding vector<a id="id2886220" class="indexterm"
+ name="id2886220"></a> describes the order and position of
+ characters within a font. The purpose of this section is to
+ help you understand the role that encoding vectors play in
+ the translation of text from your input file to printed
+ output.</p>
+
+ <p>Encoding vectors cause a lot of confusion. Whenever the
+ characters that you type in your input file are printed
+ incorrectly (&#8220;<tt>flight</tt>&#8221; in your input
+ file prints out as &#8220;ight&#8221;;
+ &#8220;\oe{}vres&#8221; prints out as
+ &#8220;\'uvres&#8221;; or &#8220;<tt>---</tt>&#8221; prints
+ out as &#8220;-{}-{}-&#8221; instead of &#8220;---&#8221;),
+ you've probably encountered some sort of encoding
+ problem.</p>
+
+ <p>The root of this problem is that the characters in your
+ input file are really just numbers between 0 and
+ 255.<sup>[<a id="id2886286" name="id2886286"
+ href="#ftn.id2886286">66</a>]</sup> The number 65 is
+ usually a capital A, but there is nothing intrinsic to the
+ value 65 to signify this. In order to display these byte
+ values, they have to be translated into symbols.</p>
+
+ <p>These problems arise because there are at least four
+ different translations occurring between what you type and
+ what appears on the printed (or previewed) page:</p>
+
+ <div class="orderedlist">
+ <ol type="1">
+ <li>
+ <p>You type some symbols on the keyboard, and they
+ are displayed by your editor. The configuration of
+ your system determines how these characters appear.
+ Sometimes they are from the ISO Latin-1 symbol set,
+ sometimes US ASCII, sometimes something else, and
+ sometimes it is user configurable. If you confine
+ yourself to pure ASCII, you're pretty safe, but
+ that's not convenient for languages other than
+ English. When you are typing documents in Spanish,
+ it's very convenient to be able to type
+ &#8220;\&#160;n&#8221; directly in your document.</p>
+ </li>
+
+ <li>
+ <p>TeX reads your input file and translates it into
+ an internal encoding (basically ASCII). (The reverse
+ translation is performed before TeX prints any output
+ to the terminal or the log file.) The translation
+ tables used in this step are generally determined
+ when the TeX program is compiled, but several modern
+ TeXs allow you to modify these tables at runtime.</p>
+
+ <p>TeX assumes that fonts use TeX's internal
+ encoding. For example, on an IBM mainframe, which
+ uses the EBCDIC character set<a id="id2886356"
+ class="indexterm" name="id2886356"></a>, TeX
+ translates a capital A (EBCDIC 193) into ASCII 65 and
+ assumes that position 65 of the metric information
+ for the current font contains the information
+ (including ligature and kerning information) for a
+ capital A.</p>
+ </li>
+
+ <li>
+ <p>If you use control sequences to represent special
+ characters (\oe for &#8220;\oe&#8221;, for example),
+ the macro package you use is responsible for defining
+ those control sequences so they produce the correct
+ characters. If the macro package assumes that the
+ &#8220;\oe&#8221; character appears at position 247
+ of the current font, the output will not be correct
+ in a font with a different encoding.</p>
+ </li>
+
+ <li>
+ <p>The DVI driver reads TeX's <tt>DVI</tt> file and
+ assumes that the encoding vector of each font used in
+ the <tt>DVI</tt> file is the same as the encoding
+ vector of the actual fonts in the output device. For
+ <tt>PK</tt> fonts, this is probably true (since the
+ DVI driver sends the font to the printer), but for
+ fonts built into the printer, it is less likely to be
+ true.</p>
+ </li>
+ </ol>
+ </div>
+
+ <p>You may think of a font as a collection of 1 to 256
+ different symbols in a particular order. This is really a
+ font plus a particular encoding vector. It is more accurate
+ to think of a font as simply a collection of symbols (with
+ no particular number or ordering). An encoding vector
+ selects which symbols are used and in what order they
+ appear. Typically, an encoding vector can contain only 256
+ different symbols. It is important to note that changing an
+ encoding vector of a font does not simply permute the order
+ of the characters in the font, it can change which symbols
+ are actually present as well.</p>
+
+ <p>Encoding vectors are either implicit or explicit. Most
+ fonts have an implicit encoding, but some (for example,
+ Adobe Type&#160;1 fonts) contain an explicit, configurable
+ encoding. TeX fonts have an implicit encoding. TeX actually
+ uses several different encoding vectors (it uses more than
+ one because it has both text or body fonts and several
+ kinds of math and symbol fonts). The character set tables
+ in Appendix&#160;<a href="apb.html"
+ title="Appendix&#160;B.&#160;Font Samples">Appendix&#160;B</a>,
+ <span class="emphasis"><em><a href="apb.html"
+ title="Appendix&#160;B.&#160;Font Samples">Appendix&#160;B</a></em></span>,
+ show the encoding of several different fonts.</p>
+
+ <p>\font\mathit=cmmi10 Most macro packages assume that the
+ TEX TEXT encoding is being used. For example, Plain TeX
+ defines the control sequence \AE as an abbreviation for
+ character number 29 in the current font. Even when control
+ sequences aren't involved, problems can arise if the output
+ font does not have the anticipated encoding. The byte-value
+ 34 in your input file is almost always the literal double
+ quote character (<tt>"</tt>) and usually prints as a double
+ quote (which is probably what your editor displays and
+ probably what you expect). If the font encoding is
+ something different, the result will not be what you
+ expect. For example, if the current font has the TEX MATH
+ ITALIC encoding, the result is
+ &#8220;{\mathit\char34}&#8221;.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a
+ id="sec.fonts.virtualfonts"
+ name="sec.fonts.virtualfonts"></a>Virtual Fonts</h2>
+ </div>
+ </div>
+
+ <p>Virtual fonts<a id="id2886658" class="indexterm"
+ name="id2886658"></a><a id="id2886666" class="indexterm"
+ name="id2886666"></a> (stored in <tt>VF</tt> files<a
+ id="id2886687" class="indexterm"
+ name="id2886687"></a><sup>[<a id="id2886706"
+ name="id2886706" href="#ftn.id2886706">67</a>]</sup>) are a
+ relatively new addition to the TeX family. When TeX was
+ originally defined in 1970, Knuth<a id="id2886736"
+ class="indexterm" name="id2886736"></a> chose a character
+ encoding that suited his purposes, and very little effort
+ was made to parameterize the encoding. (In fact, any TeX
+ macro writer can use <span
+ class="emphasis"><em>any</em></span> encoding she wants,
+ but no general mechanism for identifying the encoding
+ exists.<sup>[<a id="id2886754" name="id2886754"
+ href="#ftn.id2886754">68</a>]</sup>) Virtual fonts combat
+ this problem by allowing the creator to define a virtual
+ font in terms of (multiple) characters from one or more
+ fonts.</p>
+
+ <p>Virtual fonts are used most commonly to change the
+ encoding vector of a font. This provides a convenient way
+ of mapping different fonts into the required encoding so
+ that they are easy to use in TeX. A virtual font consists
+ of a <tt>VF</tt> file and a <tt>TFM</tt> file. TeX uses the
+ <tt>TFM</tt> file as it would any other.</p>
+
+ <p>Figure&#160;<a href="ch05.html#fig.vfdiagram"
+ title="Figure&#160;5.4.&#160;How TeX uses a virtual font">Figure&#160;5.4</a>
+ shows how a virtual font is used by the TeX system. In this
+ case, a virtual font <tt>ctmr</tt> has been created
+ combining characters from the fonts <tt>trr0n</tt>,
+ <tt>trr6m</tt>, <tt>trr6j</tt>, and <tt>trr10j</tt>.</p>
+
+ <div class="figure">
+ <a id="fig.vfdiagram" name="fig.vfdiagram"></a>
+
+ <p class="title"><b>Figure&#160;5.4.&#160;How TeX uses a
+ virtual font</b></p>
+
+ <div class="mediaobject">
+ <img src="FIXME:" />
+ </div>
+ </div>
+
+ <p>The document uses the font <tt>ctmr</tt>. TeX uses the
+ font metric information in <tt>ctmr.tfm</tt> to compose the
+ <tt>DVI</tt> file. The DVI driver, however, discovers a
+ <tt>VF</tt> file named <tt>ctmr</tt>, so it uses the
+ instructions in the virtual font to select characters from
+ the four built-in fonts. This is a practical example. It
+ shows how the HP LaserJet built-in fonts may be accessed
+ with the standard TeX text encoding.</p>
+
+ <p>In practice, virtual fonts suffer from one limitation: A
+ virtual font can only permute the encoding vector; it
+ cannot access characters that do not appear in the encoding
+ vector of the &#8220;real&#8221; font. For example, an
+ Adobe Type&#160;1 font might contain all of the characters
+ that appear in the TeX text encoding, but many of them do
+ not appear in the standard Adobe encoding vector. A virtual
+ font alone cannot remap the characters into the TeX text
+ encoding. The encoding vector of the font must also be
+ changed. Several PostScript DVI drivers have this
+ ability.</p>
+
+ <p>Virtual fonts are binary files and are very difficult to
+ edit. To make it possible to construct virtual fonts by
+ hand, TeX includes standard utilities (<b>VFtoVP</b><a
+ id="id2886971" class="indexterm" name="id2886971"></a> and
+ <b>VPtoVF</b><a id="id2886985" class="indexterm"
+ name="id2886985"></a>) for converting the binary
+ <tt>VF</tt> format into a human-readable <tt>VPL</tt>
+ format. The <tt>VPL</tt> files are text files that can be
+ edited with a text editor.</p>
+
+ <p>A complete description of how to create virtual fonts is
+ beyond the scope of this book. If you are interested in
+ experimenting with virtual fonts, I strongly recommend that
+ you examine the <b>fontinst</b> package.<sup>[<a
+ id="id2887038" name="id2887038"
+ href="#ftn.id2887038">69</a>]</sup> <b>fontinst</b><a
+ id="id2887070" class="indexterm" name="id2887070"></a>
+ allows you to construct <tt>VPL</tt> files with TeX
+ documents. This isn't as strange as it first sounds.
+ Virtual font files have to include the metric information
+ from <tt>TFM</tt> files for each font that they include.
+ Because TeX can easily read this information, and the
+ output is a plain text document anyway, TeX is a very
+ capable, if somewhat slow, tool.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a
+ id="sec.autofont" name="sec.autofont"></a>Automatic
+ Font Generation by DVI Drivers</h2>
+ </div>
+ </div>
+
+ <p>Recent releases of many popular DVI drivers (\dvips<a
+ id="id2887119" class="indexterm" name="id2887119"></a>,
+ xdvi<a id="id2887132" class="indexterm"
+ name="id2887132"></a>, \SeeTeX<a id="id2887140"
+ class="indexterm" name="id2887140"></a>, and emTeX<a
+ id="id2887151" class="indexterm" name="id2887151"></a>'s
+ DVI drivers, to name a few) include the ability to generate
+ missing fonts automatically<a id="id2887162"
+ class="indexterm" name="id2887162"></a><a id="id2887174"
+ class="indexterm" name="id2887174"></a>. Automatic font
+ generation overcomes two problems simultaneously: it
+ reduces disk space requirements, and it makes font
+ generation easier. Most implementations of TeX are
+ distributed with a complete set of Computer Modern fonts at
+ seven or more magnifications. This can easily amount to
+ several megabytes of disk space (even more if you are using
+ other fonts, like the \AmS fonts<a id="id2887193"
+ class="indexterm" name="id2887193"></a> from the American
+ Mathematical Society<a id="id2887205" class="indexterm"
+ name="id2887205"></a>). In practice, you probably use only
+ a small subset of these fonts.</p>
+
+ <p>One way to combat the disk-space problem is to delete
+ all of the TeX fonts on your system and build just the ones
+ you actually use. In the days before automatic font
+ generation, this would have been quite unpleasant. The
+ first time you discovered that you needed a font that you
+ did not have, you would have to stop your DVI driver,
+ figure out what size was missing, figure out how to get
+ MetaFont to build the font that was missing at the
+ appropriate resolution, run MetaFont, store the font in the
+ right place, and return to your DVI driver. Moments later,
+ you might discover that you had to do the whole process
+ again for some other font.</p>
+
+ <p>Using a driver that provides automatic font generation
+ makes it nearly painless to delete fonts and let them be
+ built automatically.<sup>[<a id="id2887238"
+ name="id2887238" href="#ftn.id2887238">70</a>]</sup> The
+ DVI driver determines the resolution required, runs
+ MetaFont with the appropriate parameters, stores the font
+ in the correct place, and continues processing the document
+ uninterrupted.</p>
+
+ <p>The down side of automatic font generation is that you
+ must keep the MetaFont program around and make available
+ the source files for the Computer Modern fonts (and any
+ other MetaFont fonts that you use). If you do not already
+ have these files on your hard disk, the potential disk
+ space savings are somewhat reduced. (MetaFont is discussed
+ fully in Chapter&#160;<a href="ch11.html"
+ title="Chapter&#160;11.&#160;Introducing MetaFont">Chapter&#160;11</a>.)
+ Moreover, automatic font generation can only build
+ <tt>PK</tt> files<a id="id2887281" class="indexterm"
+ name="id2887281"></a>; if <tt>TFM</tt> files are also
+ missing, you will have to build those by hand before TeX
+ can process your document.<sup>[<a id="id2887312"
+ name="id2887312" href="#ftn.id2887312">71</a>]</sup></p>
+
+ <p>Another benefit of automatic font generation is that it
+ can be used to provide previewers, even non-PostScript
+ previewers, with the ability to preview documents that use
+ PostScript fonts, provided that you have the Printer Font
+ ASCII (<tt>PFA</tt>)<a id="id2887344" class="indexterm"
+ name="id2887344"></a> or Printer Font Binary
+ (<tt>PFB</tt>)<a id="id2887363" class="indexterm"
+ name="id2887363"></a> font sources and Adobe Font Metric
+ (<tt>AFM</tt>)<a id="id2887382" class="indexterm"
+ name="id2887382"></a> for your PostScript fonts.</p>
+
+ <p>The following lines, added to the <tt>MakeTeXPK</tt><a
+ id="id2887401" class="indexterm" name="id2887401"></a>
+ script distributed with <b>dvips</b>, provide automatic
+ font generation for PostScript fonts with <b>ps2pk</b><a
+ id="id2887423" class="indexterm" name="id2887423"></a>.
+ This is useful even on systems where PostScript printers
+ are used for output, because previewers like <b>xdvi</b><a
+ id="id2887438" class="indexterm" name="id2887438"></a> also
+ use <b>MakeTeXPK</b> to build missing fonts.</p>
+<pre class="screen">
+# Look for a PostScript outline font...
+if [ -r /usr/local/lib/tex/ps/outlines/$NAME.pfa ]
+then
+ echo Building TeX font from PostScript outline
+ # Hack. If $6 is null, $DESTDIR =&gt; $6 ...
+ PStoTeXfont $1 $2 $3 $4 $5 $6 $DESTDIR
+ exit 0
+else
+ echo Building TeX font from MetaFont outline
+fi
+</pre>
+
+ <p>In this example, PostScript fonts are stored in the
+ <tt>/usr/local/lib/tex/ps/outlines</tt> directory. You
+ should change this directory to something appropriate for
+ your system. On a unix system, the <b>PStoTeXfont</b>
+ script shown in Example&#160;<a
+ href="ch05.html#ex.pstotexfont"
+ title="Example&#160;5.3.&#160;The PStoTeXfont script">Example&#160;5.3</a>
+ is appropriate.<sup>[<a id="id2887500" name="id2887500"
+ href="#ftn.id2887500">72</a>]</sup> A <b>Perl</b> version
+ of <b>MakeTeXPK</b> that handles both MetaFont and
+ PostScript fonts is shown in Example&#160;<a
+ href="apd.html#ex.maketexpk"
+ title="Example&#160;D.1.&#160;MakeTeXPK.pl">Example&#160;D.1</a>
+ in Appendix&#160;<a href="apd.html"
+ title="Appendix&#160;D.&#160;Long Examples">Appendix&#160;D</a>,
+ <span class="emphasis"><em><a href="apd.html"
+ title="Appendix&#160;D.&#160;Long Examples">Appendix&#160;D</a></em></span>.</p>
+
+ <div class="example">
+ <a id="ex.pstotexfont" name="ex.pstotexfont"></a>
+
+ <p class="title"><b>Example&#160;5.3.&#160;The
+ PStoTeXfont script</b></p>
+<pre class="screen">
+#!/usr/local/bin/bash
+#
+# This script file makes a new TeX font from a PS outline.
+#
+# Parameters are:
+#
+# name dpi bdpi [mag mode destdir]
+#
+# `name' is the name of the font, such as `ptmr'. `dpi'
+# is the resolution the font is needed at. `bdpi' is
+# the base resolution.
+#
+# This script ignores the remaining parameters. They are
+# left here to document the fact that the caller may provide
+# them. They may be provided because the caller thinks
+# MetaFont is going to do the work...
+#
+# Of course, this needs to be set up for your site.
+#
+# TEMPDIR needs to be unique for each process because of the
+# possibility of simultaneous processes running this script.
+
+TEMPDIR=/tmp/temp-tex-PS.$$
+NAME=$1
+DPI=$2
+BDPI=$3
+
+LOCALDIR=/usr/local/lib/mf/fonts
+DESTDIR=$LOCALDIR/pk
+
+BASENAME=$NAME.$DPI
+PFADIR=/usr/local/lib/tex/ps/outlines
+
+# Clean up on normal or abnormal exit
+trap "cd /; rm -rf $TEMPDIR" 0 1 2 15
+
+mkdir $TEMPDIR
+cd $TEMPDIR
+
+# We proceed by making a 10pt font at the resolution
+# requested...
+echo Making ${DPI}dpi version of $NAME.
+ps2pk -X$DPI -P10 -a$PFADIR/$NAME.afm $PFADIR/$NAME.pfa ${BASENAME}pk
+
+mv ${BASENAME}pk $DESTDIR
+
+exit 0
+</pre>
+ </div>
+
+ <p>A similar script for using automatic font generation
+ under emTeX with <b>4DOS</b> is shown in Examples&#160;<a
+ href="apd.html#ex.dvidxx"
+ title="Example&#160;D.3.&#160;dvidxx.btm">Example&#160;D.3</a>
+ and&#160;<a href="apd.html#ex.makepk"
+ title="Example&#160;D.4.&#160;makepk.btm">Example&#160;D.4</a>
+ in Appendix&#160;<a href="apd.html"
+ title="Appendix&#160;D.&#160;Long Examples">Appendix&#160;D</a>.
+ Several other options are available for performing
+ automatic font generation on a number of platforms,
+ including a <b>REXX</b> version for OS/2 and a compiled
+ program called <b>MKTeXPK</b>.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a
+ id="sec.t1fonts" name="sec.t1fonts"></a>Math Fonts in
+ TeX</h2>
+ </div>
+ </div>
+
+ <p>Changing math fonts<a id="id2887679" class="indexterm"
+ name="id2887679"></a><a id="id2887686" class="indexterm"
+ name="id2887686"></a> is more difficult than changing text
+ fonts. In addition to the large number of special symbols
+ that must be available, TeX needs a lot more information to
+ use the fonts because the characters are combined more
+ frequently and in more complex ways. For example, the open
+ brace character (\{) in math mode is
+ &#8220;extensible;&#8221; this means that it can be as
+ large as required. In order for TeX to construct a brace of
+ arbitrary size, one of the math fonts (the math extensions
+ font) contains four different characters that TeX combines
+ to form the brace:</p>
+
+ <p>FIXME: brace pieces</p>
+
+ <p>Extensible recipes for characters like &#8220;\{&#8221;,
+ &#8220;\}&#8221;, &#8220;(&#8221;, and &#8220;)&#8221; are
+ examples of additional metric information that must be
+ available in math fonts for TeX.</p>
+
+ <p>In addition to the Computer Modern math fonts, there are
+ really only three other choices at present: the \AmS
+ fonts<a id="id2887745" class="indexterm"
+ name="id2887745"></a> (MetaFont fonts freely distributed by
+ the American Mathematical Society<a id="id2887758"
+ class="indexterm" name="id2887758"></a> which extend but do
+ not replace the Computer Modern math fonts), the Lucida
+ Bright+New Math fonts<a id="id2887768" class="indexterm"
+ name="id2887768"></a>, and the MathTime fonts<a
+ id="id2887778" class="indexterm" name="id2887778"></a>.
+ Lucida Bright and MathTime are both sets of commercial
+ PostScript Type&#160;1 fonts.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h2 class="title" style="clear: both"><a id="id2887790"
+ name="id2887790"></a>Concrete Examples</h2>
+ </div>
+ </div>
+
+ <p>The following sections describe by example how you can
+ use several different kinds of fonts in TeX. The tools
+ described are generally free and generally available for
+ multiple platforms. Where specific commercial tools are
+ used, free alternatives are discussed.</p>
+
+ <p>The specific tools I mention here are not the only tools
+ available nor are they necessarily the best, although I
+ hope I've found the best ones. If you have found a
+ different and better solution, don't abandon it in favor of
+ what I use here. But please do tell me about the method
+ that you have found. With every passing day, more free
+ software becomes available.</p>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2887816"
+ name="id2887816"></a>MetaFont Fonts</h3>
+ </div>
+ </div>
+
+ <p>Chapter&#160;<a href="ch11.html"
+ title="Chapter&#160;11.&#160;Introducing MetaFont">Chapter&#160;11</a>
+ describes how to use MetaFont to create fonts for TeX.<a
+ id="id2887825" class="indexterm" name="id2887825"></a><a
+ id="id2887847" class="indexterm" name="id2887847"></a> If
+ you have MetaFont installed, you can easily create fonts
+ that are usable in TeX.</p>
+
+ <p>MetaFont reads <tt>MF</tt> files, which are plain text
+ files that describe a font analogous to the way TeX reads
+ <tt>TEX</tt> files that describe a document.</p>
+
+ <p>Appendix&#160;<a href="apb.html"
+ title="Appendix&#160;B.&#160;Font Samples">Appendix&#160;B</a>,
+ <span class="emphasis"><em><a href="apb.html"
+ title="Appendix&#160;B.&#160;Font Samples">Appendix&#160;B</a></em></span>,
+ contains examples of many MetaFont fonts. Consult the
+ &#8220;Definitive List of All Fonts Available for
+ {MetaFont}&#8221;&#160;[<a
+ href="bi01.html#lreq:metafonts">lreq:metafonts</a>] for
+ an up-to-date list with availability information.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2887929"
+ name="id2887929"></a>PostScript Type 1 Fonts</h3>
+ </div>
+ </div>
+
+ <p>PostScript printers have many PostScript Type&#160;1<a
+ id="id2887939" class="indexterm" name="id2887939"></a><a
+ id="id2887949" class="indexterm" name="id2887949"></a>
+ fonts built in. If you want to use built-in fonts, you
+ only need the metric information for them and a
+ PostScript DVI driver. The <b>dvips</b> driver is the
+ most popular free DVI driver. Several commercial drivers
+ are also available.</p>
+
+ <p>The metric information should be available in the form
+ of Adobe Font Metric (<tt>AFM</tt>) files<a
+ id="id2887986" class="indexterm" name="id2887986"></a>
+ from the printer vendor or directly from Adobe Systems<a
+ id="id2888007" class="indexterm" name="id2888007"></a>,
+ Inc. You need a program that will convert <tt>AFM</tt>
+ files into <tt>TFM</tt> files<a id="id2888034"
+ class="indexterm" name="id2888034"></a>. There are
+ several free programs that will do this conversion (one
+ is included with <b>dvips</b>), and your DVI driver may
+ have included one. In general, if one came with your DVI
+ driver, that is the one you should use.</p>
+
+ <p>If you want to use PostScript Type&#160;1 fonts on
+ non-PostScript devices, like most screen previewers, you
+ need the &#8220;sources&#8221; for the fonts that you
+ want to use. Many font vendors sell fonts in Adobe
+ Type&#160;1 format. In addition, there are many
+ Type&#160;1 fonts available on the Internet and on
+ bulletin board systems.<sup>[<a id="id2888068"
+ name="id2888068" href="#ftn.id2888068">73</a>]</sup></p>
+
+ <p>Several companies have made complete, high-quality
+ fonts available. They are:</p>
+
+ <div class="table">
+ <a id="id2888084" name="id2888084"></a>
+
+ <p class="title"><b>Table&#160;5.7.&#160;</b></p>
+
+ <table summary="" border="1">
+ <colgroup>
+ <col align="left" />
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th align="left">IBM Courier</th>
+
+ <th>URW Antiqua</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td align="left">Bitstream Courier</td>
+
+ <td>URW Grotesk Bold</td>
+ </tr>
+
+ <tr>
+ <td align="left">Bitstream Charter</td>
+
+ <td>Nimbus Roman No9</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <p>Check the license that accompanies these fonts to make
+ sure that you can use them legally.</p>
+
+ <p>PostScript Type&#160;1 font sources are available in
+ Printer Font ASCII (<tt>PFA</tt>)<a id="id2888169"
+ class="indexterm" name="id2888169"></a> and Printer Font
+ Binary (<tt>PFB</tt>)<a id="id2888188" class="indexterm"
+ name="id2888188"></a> formats.<sup>[<a id="id2888196"
+ name="id2888196" href="#ftn.id2888196">74</a>]</sup> The
+ <tt>PFB</tt> format is more compact, but less portable.
+ unix systems usually use <tt>PFA</tt> files, while MS-DOS
+ and OS/2 systems use <tt>PFB</tt> files. Several existing
+ programs can convert <tt>PFB</tt> files into <tt>PFA</tt>
+ files and vice-versa. For the remainder of this section,
+ I will consistently refer to PostScript Type&#160;1
+ source files as <tt>PFA</tt> files, although you can use
+ <tt>PFB</tt> files instead if they are supported on your
+ platform.</p>
+
+ <p>In addition to the <tt>PFA</tt> files, you will also
+ need metric information for the fonts. The metric
+ information <span class="emphasis"><em>should</em></span>
+ be available in <tt>AFM</tt> format. If you purchased
+ fonts from a vendor and did not receive <tt>AFM</tt>
+ files, you should complain. Fonts from free sources, like
+ Internet archive sites and bulletin board systems
+ sometimes include only Printer Font Metric
+ (<tt>PFM</tt>)<a id="id2888341" class="indexterm"
+ name="id2888341"></a> files. These are Microsoft Windows
+ printer metric files, and they do not contain enough
+ information to make a <tt>TFM</tt> file.</p>
+
+ <p>It is possible to create a <tt>TFM</tt> file from the
+ <tt>PFM</tt> file, but the metrics are not particularly
+ good. To do this:</p>
+
+ <div class="orderedlist">
+ <ol type="1">
+ <li>
+ <p>Convert the <tt>PFM</tt> file into an incomplete
+ <tt>AFM</tt> file with the <b>PFM2AFM</b><a
+ id="id2888427" class="indexterm"
+ name="id2888427"></a> utility.</p>
+ </li>
+
+ <li>
+ <p>Use the <b>PS2PK</b><a id="id2888449"
+ class="indexterm" name="id2888449"></a> program to
+ make a <tt>PK</tt> file.</p>
+ </li>
+
+ <li>
+ <p>Use <b>PKBBOX</b><a id="id2888481"
+ class="indexterm" name="id2888481"></a> to create a
+ more complete <tt>AFM</tt> file from the incomplete
+ <tt>AFM</tt> file and the <tt>PK</tt> file.</p>
+ </li>
+ </ol>
+ </div>
+
+ <p>The <tt>AFM</tt> file manufactured in this way can be
+ used to create a <tt>TFM</tt> file. The <tt>PK</tt> file
+ can be used by any DVI driver that understands TeX
+ <tt>PK</tt> fonts (almost all drivers have this
+ ability).</p>
+
+ <p>Creating <tt>PK</tt> files does require more disk
+ space, but it has the advantage that you can print TeX
+ documents which use PostScript Type&#160;1 fonts on
+ non-PostScript devices. This includes fast,
+ <tt>PK</tt>-based screen previewers like <b>xdvi</b> and
+ emTeX's <b>dviscr</b> that do not understand
+ PostScript.</p>
+
+ <p>Programs like <b>dvipsone</b><a id="id2888617"
+ class="indexterm" name="id2888617"></a> and
+ <b>dviwindo</b><a id="id2888631" class="indexterm"
+ name="id2888631"></a> which run under the Microsoft
+ Windows environment can use PostScript fonts directly if
+ Adobe Type Manager (ATM)<a id="id2888641"
+ class="indexterm" name="id2888641"></a> is installed on
+ the system. However, it is still necessary to construct
+ the <tt>TFM</tt> files for TeX.</p>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h4 class="title"><a id="id2888662"
+ name="id2888662"></a>{Using a new PostScript font
+ in TeX (for PostScript printers)}</h4>
+ </div>
+ </div>
+
+ <p>This section presents a step-by-step description of
+ how to use a new PostScript font in TeX with a
+ PostScript printer or previewer. In this situation, you
+ have a PostScript printer, and you use <b>dvips</b> to
+ print your documents. This method also allows you to
+ preview your documents with <b>Ghostscript</b>.</p>
+
+ <p>For either method, you must first obtain the
+ PostScript sources for the font that you want to use.
+ You <span class="emphasis"><em>must</em></span> have a
+ <tt>PFA</tt> or <tt>PFB</tt> file and an <tt>AFM</tt>
+ file. As a concrete example, I'll use the &#8220;Nimbus
+ Roman 9L Regular&#8221; font. For this font, I obtain
+ <tt>unmr.pfa</tt> and <tt>unmr.afm</tt>. These fonts
+ are available from the CTAN archives in the directory
+ <tt>fonts/urw</tt>.<sup>[<a id="id2888763"
+ name="id2888763" href="#ftn.id2888763">75</a>]</sup> In
+ order to use the font in TeX, you must create TeX font
+ metrics for it using <b>afm2tfm</b><a id="id2888801"
+ class="indexterm" name="id2888801"></a> (in particular,
+ the version of <b>afm2tfm</b> that comes with
+ <b>dvips</b>).</p>
+
+ <p>First, however, we must decide what encoding vector
+ to use. Frequently, the fonts you obtain use Adobe
+ Standard Encoding. The problem with this encoding is
+ that it isn't very complete; it leaves out a lot of
+ standard TeX characters (like the ligatures
+ &#8220;fi&#8221; and &#8220;fl&#8221; as well as many
+ accented and international letters). Instead of using
+ Adobe Standard Encoding<a id="id2888843"
+ class="indexterm" name="id2888843"></a>, I recommend
+ using the Cork Encoding<a id="id2888852"
+ class="indexterm" name="id2888852"></a>. The Cork
+ Encoding has several advantages; it is a superset of
+ the original TeX text encoding; it is becoming a new
+ standard for TeX; and it is supported by the NFSS2. Of
+ course, the Cork Encoding is not suitable for all
+ fonts; there's no reason to try to re-encode a symbol
+ font into the Cork Encoding---that doesn't even make
+ any sense.</p>
+
+ <p>Luckily, using the Cork Encoding is no more
+ difficult than using whatever encoding the distributed
+ font contains. <b>afm2tfm</b> will do all the work. You
+ only need to obtain the appropriate encoding file. In
+ this case, the file is <tt>ec.enc</tt>, and it is
+ distributed with both <b>dvips</b> and NFSS2. Use
+ <b>afm2tfm</b> to generate the metrics:</p>
+<pre class="screen">
+\$ {\bf afm2tfm unmr.afm -v unmr.vpl -T ec.enc unmr0.tfm}
+</pre>
+
+ <p>This command reads <tt>unmr.afm</tt>, the original
+ <tt>AFM</tt> file with an arbitrary encoding, and the
+ encoding vector <tt>ec.enc</tt>. It creates the virtual
+ font <tt>unmr.vpl</tt> and the <tt>TFM</tt> file
+ <tt>unmr0.tfm</tt>.</p>
+
+ <p>The relationship between these files is subtle. The
+ <tt>AFM</tt> file contains metric information for all
+ the possible glyphs<a id="id2888978" class="indexterm"
+ name="id2888978"></a> in the font. The encoding file
+ establishes the encoding vector---which particular
+ characters occur in exactly what order. These two files
+ are combined to produce character metric information
+ for the specific encoding vector. This information is
+ saved in the <tt>TFM</tt> file. This is a
+ &#8220;raw&#8221; <tt>TFM</tt> file<a id="id2889015"
+ class="indexterm" name="id2889015"></a>.<sup>[<a
+ id="id2889026" name="id2889026"
+ href="#ftn.id2889026">76</a>]</sup> It does not have
+ any ligature or kerning information and <span
+ class="emphasis"><em>may</em></span> have a different
+ encoding from the virtual font (although, in this case
+ it has the same encoding).</p>
+
+ <p>The next step is to produce a virtual font from the
+ <tt>VPL</tt> file<a id="id2889087" class="indexterm"
+ name="id2889087"></a>:</p>
+<pre class="screen">
+\$ {\bf vptovf unmr.vpl unmr.vf unmr.tfm}
+</pre>
+
+ <p>This produces a virtual font file, <tt>unmr.vf</tt>,
+ and an appropriate <tt>TFM</tt> file. This <tt>TFM</tt>
+ file has ligature and kerning information for the
+ characters in the font as well as the metrics for the
+ individual glyphs.</p>
+
+ <p>The names of the virtual font files and the related
+ <tt>TFM</tt> files are entirely arbitrary. You can give
+ them any names you wish. In the long run, you will
+ benefit if you choose a naming scheme that allows you
+ to determine which files are which simply by examining
+ the names. If you have a lot of fonts, take a look at
+ <span class="emphasis"><em>{Filenames for
+ Fonts}</em></span>&#160;[<a
+ href="bi01.html#tug:filenames-fonts">tug:filenames-fonts</a>].
+ It is also available electronically from CTAN in the
+ directory <tt>info/filename</tt>.</p>
+
+ <p>Now you should install the <tt>VF</tt> and
+ <tt>TFM</tt> files in the appropriate directories and
+ proceed to use the <tt>unmr</tt> font. TeX will do the
+ right thing because the <tt>TFM</tt> file contains the
+ appropriate metric information, and the DVI driver will
+ do the right thing because it has a virtual font which
+ specifies how the characters should be mapped into the
+ printer.</p>
+
+ <p>Now that TeX is happy, we have the additional
+ problem of making the PostScript printer happy. The
+ easiest way to do this is to tell <b>dvips</b> to do it
+ for us. The <tt>psfonts.map</tt> file used by
+ <b>dvips</b> identifies which fonts are built into the
+ printer and which fonts need to be downloaded.</p>
+
+ <p>Each line in the <tt>psfonts.map</tt> file describes
+ how a particular TeX font should be interpreted. The
+ simplest lines identify the PostScript name of fonts
+ built into the printer. For \linebreak</p>
+
+ <p>example, the following line indicates that
+ <b>dvips</b><a id="id2889279" class="indexterm"
+ name="id2889279"></a> should use the PostScript font
+ Times-Roman (which is assumed to be resident in the
+ printer) everywhere that the <tt>DVI</tt> file uses the
+ font <tt>rptmr</tt>:</p>
+<pre class="screen">
+rptmr Times-Roman
+</pre>
+
+ <p>To automatically download a PostScript font<a
+ id="id2889318" class="indexterm" name="id2889318"></a>,
+ add <tt>&lt;</tt><tt><i><tt>fontfile</tt></i></tt> to
+ the corresponding line in the <tt>psfonts.map</tt>
+ file. The following entry indicates that the PostScript
+ font CharterBT-Roman should be used where
+ <tt>rbchr</tt> is used in the document. In addition,
+ <b>dvips</b> should download the font from the file
+ <tt>/usr/local/lib/fonts/psfonts/bchr.pfa</tt> if it is
+ used in the document.</p>
+<pre class="screen">
+rbchr CharterBT-Roman &lt;/usr/local/lib/fonts/psfonts/bchr.pfa
+</pre>
+
+ <p>Additional PostScript commands can be added to the
+ entry to perform special effects. Some of these are
+ described in the documentation for <b>dvips</b>. They
+ require a knowledge of PostScript that is beyond the
+ scope of this book.</p>
+
+ <p>Adding the following line to <tt>psfonts.map</tt>
+ will download and use the Nimbus URW font we installed
+ above. (It is shown on two lines only because of the
+ constraints of the page; you should enter it on one
+ line):</p>
+<pre class="screen">
+unmr0 NimbusRomanNo9L-Regular &lt;unmr.pfa
+ "ECEncoding ReEncodeFont" &lt;ec.enc
+</pre>
+
+ <p>This line identifies the font <tt>unmr0</tt> as the
+ NimbusRomanNo9L-Regular PostScript font, re-encoded
+ with the ECEncoding described in the file
+ <tt>ec.enc</tt>. Because this font is not resident in
+ the printer, you must also tell <b>dvips</b> to
+ download the font from <tt>unmr.pfa</tt>. If you keep
+ encoding files or PostScript fonts (<tt>PFB</tt> or
+ <tt>PFA</tt> files) in nonstandard locations, you will
+ have to specify the full path of <tt>ec.enc</tt> and/or
+ <tt>unmr.pfa</tt>.</p>
+
+ <p>Notice that you specify the <span
+ class="emphasis"><em>raw</em></span> font in the
+ <tt>psfonts.map</tt> file. TeX and <b>dvips</b> will
+ use the virtual font to determine which character(s)
+ from which raw font(s) should <span
+ class="emphasis"><em>actually</em></span> be used to
+ print your document. <b>afm2tfm</b> prints the line
+ that should be added to the font map file when it is
+ finished converting the font, so you don't always have
+ to remember which is which.</p>
+
+ <p>The <tt>psfonts.map</tt> file (and the encoding and
+ font files) are typically stored in a system-default
+ location. On unix systems, this is frequently
+ <tt>/usr/local/lib/tex/ps</tt>. If you can't (or don't
+ want) to change files in this directory, you can use
+ your own font map file.</p>
+
+ <p>When you run <b>dvips</b>, it loads a initialization
+ file (typically <tt>~/.dvipsrc</tt>). If you put the
+ following line in that file:</p>
+<pre class="screen">
+p +/home/jdoe/myfonts.map
+</pre>
+
+ <p>it extends the system-wide font map using the file
+ <tt>/home/jdoe/myfonts.map</tt>, which has the same
+ format as the <tt>psfonts.map</tt> file.</p>
+
+ <p>If you use the <tt>&lt;font.pfa</tt> syntax in your
+ font map file to download PostScript fonts, you may
+ discover that <b>dvips</b> is producing very large
+ output files (or takes a long time to print, if output
+ is going directly to a printer). The reason is that
+ <b>dvips</b> is downloading the font at the beginning
+ of every document that uses it. If you have a few fonts
+ that you use all the time, it may be faster and more
+ convenient to download the fonts manually at the
+ beginning of the day and then remove the
+ <tt>&lt;font.pfa</tt> portion of the font mapping line
+ (leave the encoding file, however). This will produce
+ smaller output files because <b>dvips</b> will assume
+ that the fonts are already downloaded. Of course, the
+ trade-off is that your documents will not print
+ correctly (because the appropriate fonts are not
+ attached to the PostScript file) if you mail them to a
+ colleague who doesn't download the same fonts you do,
+ or if you forget to download the fonts again after
+ someone power-cycles the printer.<sup>[<a
+ id="id2889655" name="id2889655"
+ href="#ftn.id2889655">77</a>]</sup></p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h4 class="title"><a id="id2889664"
+ name="id2889664"></a>{Using a new PostScript font
+ in TeX (for non-PostScript devices)}</h4>
+ </div>
+ </div>
+
+ <p>Using PostScript fonts for screen previewing or
+ printing on non-PostScript printers is a very different
+ process from printing on PostScript devices. You still
+ need the <tt>AFM</tt> and <tt>PFA</tt> files.</p>
+
+ <p>This time you're going to create <tt>PK</tt> files
+ with <b>ps2pk</b><a id="id2889716" class="indexterm"
+ name="id2889716"></a>, so virtual fonts are less
+ useful. In fact, you have to give the <tt>AFM</tt> file
+ the correct encoding in order to get the right
+ <tt>PK</tt> file, so we'll avoid virtual fonts
+ altogether. Of course, if you need several different
+ encodings (perhaps TeX Text, Cork, and Adobe Standard)
+ for different documents, you'll be better off with one
+ or two raw font files and several virtual fonts, but
+ for the moment let's imagine that that is not the
+ case.</p>
+
+ <p>Example&#160;<a href="apd.html#ex.encafmpl"
+ title="Example&#160;D.5.&#160;enc-afm.pl">Example&#160;D.5</a>
+ in Appendix&#160;<a href="apd.html"
+ title="Appendix&#160;D.&#160;Long Examples">Appendix&#160;D</a>,
+ <span class="emphasis"><em><a href="apd.html"
+ title="Appendix&#160;D.&#160;Long Examples">Appendix&#160;D</a></em></span>,
+ is a Perl script that changes the encoding vector in an
+ <tt>AFM</tt> file to reflect the encoding specified in
+ an encoding file (like the ones used in the preceding
+ section). This is an important step because
+ <b>ps2pk</b> uses the encoding in the <tt>AFM</tt> file
+ to determine which glyphs to render.<sup>[<a
+ id="id2889816" name="id2889816"
+ href="#ftn.id2889816">78</a>]</sup></p>
+
+ <p>To install this script, save it in a file called
+ <tt>enc-afm.pl</tt> and change the top of the script
+ (the <tt>#!</tt> line) to reflect where Perl is
+ installed on your system. Users of Perl on non-unix
+ systems may have to work a little harder, or simply use
+ the syntax <span class="emphasis"><em>{perl
+ enc-afm.pl}</em></span> to run the script. unix users
+ can create a symbolic link to <tt>enc-afm.pl</tt>
+ called <tt>enc-afm</tt>, and mark it as executable.</p>
+
+ <p>Using this script, transform <tt>unmr.afm</tt> into
+ <tt>unmrX.afm</tt>:</p>
+<pre class="screen">
+\$ <span
+class="bold"><b>enc-afm unmr.afm ec.enc &gt; unmrX.afm</b></span>
+</pre>
+
+ <p>Now the <tt>unmrX.afm</tt> file has the Cork
+ encoding. We can use this file to create a <tt>TFM</tt>
+ file for TeX:</p>
+<pre class="screen">
+\$ <span class="bold"><b>afm2tfm unmrX.afm unmr.tfm</b></span>
+</pre>
+
+ <p>This <tt>TFM</tt> file should be moved to the
+ directory where you store <tt>TFM</tt> files for
+ TeX.</p>
+
+ <p>Unlike PostScript fonts on PostScript devices,
+ different <tt>PK</tt> files must be created for each
+ size required. As a concrete example, let's assume we
+ want a 14pt font. The easiest way to create a 14pt font
+ with <b>ps2pk</b> is to use the <span
+ class="emphasis"><em>-P</em></span> parameter to
+ specify the size. Unfortunately, this will cause some
+ DVI drivers to complain because <span
+ class="emphasis"><em>-P</em></span> sets the design
+ size of the <tt>PK</tt> file, and it won't match the
+ design size in the <tt>TFM</tt> file. A better solution
+ is to determine the resolution you need with the
+ following formula:</p>
+
+ <p>$$\hbox{resolution} = {{\hbox{base resolution} *
+ \hbox{point size}}\over{10}}$$</p>
+
+ <p>The factor 10 is used because it is the nominal
+ design size of PostScript fonts (at least, that's what
+ <b>afm2tfm</b> uses). For example, if we are creating a
+ 14pt font for a 300dpi laser printer, the desired
+ resolution is $300*14/10 = 420$. Now we can create the
+ font:</p>
+<pre class="screen">
+\$ <span
+class="bold"><b>ps2pk -X420 -aunmrX.afm unmr.pfa unmr.420pk</b></span>
+</pre>
+
+ <p>This command creates a 420dpi <tt>PK</tt> file using
+ the <tt>AFM</tt> file <tt>unmrX.afm</tt>. The font
+ source comes from <tt>unmr.pfa</tt>, and the resulting
+ <tt>PK</tt> file is called <tt>unmr.pk</tt>. On MS-DOS
+ systems, name the output <tt>PK</tt> file
+ <tt>unmr.pk</tt> because <tt>unmr.420pk</tt> is not a
+ valid filename. Move the resulting <tt>PK</tt> file to
+ the appropriate directory. On unix systems, it is
+ probably <tt>/usr/local/lib/tex/fonts/pk</tt>; while on
+ MS-DOS and other systems, it is probably something like
+ <tt>/texfonts/420dpi</tt>.</p>
+ </div>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2890165"
+ name="id2890165"></a>HP LaserJet Softfonts</h3>
+ </div>
+ </div>
+
+ <p>Bitmapped HP LaserJet Softfonts<a id="id2890174"
+ class="indexterm" name="id2890174"></a> can easily be
+ converted into TeX <tt>PK</tt> files with the
+ <b>SFPtoPK</b> utility. Then they can be used with almost
+ any DVI driver.</p>
+
+ <p>Scalable LaserJet Softfonts can be used by TeX if two
+ conditions are met: metric information is available, and
+ the DVI driver that you are using can access built-in
+ printer fonts. Metric information for Scalable LaserJet
+ Softfonts distributed by Hewlett-Packard come in the form
+ of Tagged Font Metric files. Tagged Font Metric files
+ have the extension <tt>TFM</tt>, but they should not be
+ confused with TeX <tt>TFM</tt> files. The utility
+ <b>hptfm2pl</b> converts Tagged Font Metric files into
+ TeX <tt>PL</tt> files (<tt>PL</tt> is a human-readable
+ text format of <tt>TFM</tt> files). <tt>PL</tt> files are
+ transformed into <tt>TFM</tt> files by the standard TeX
+ utility <b>PLtoTF</b>.</p>
+
+ <p>To use Scalable LaserJet Softfonts, you must convert
+ the metric information into TeX <tt>TFM</tt> files so
+ that TeX can use the font, and then you must inform your
+ DVI driver that the fonts are built into the printer.
+ Before printing your document, download the Scalable
+ LaserJet Softfont to your printer. The <b>sfload</b>
+ utility that is part of Sfware can download Scalable
+ LaserJet Fonts. Many other free and shareware font
+ downloading programs exist, too.</p>
+ </div>
+
+ <div class="section">
+ <div class="titlepage">
+ <div>
+ <h3 class="title"><a id="id2890329"
+ name="id2890329"></a>TrueType Fonts</h3>
+ </div>
+ </div>
+
+ <p>At present, TrueType fonts<a id="id2890338"
+ class="indexterm" name="id2890338"></a> can be used only
+ on systems that have built-in TrueType support (the
+ Macintosh and MS-DOS computers running Microsoft Windows
+ 3.1 fall into this category). You must use DVI drivers
+ that communicate with the printer through the system's
+ printer interface.</p>
+ </div>
+ </div>
+
+ <div class="footnotes">
+ <br />
+ <hr width="100" align="left" />
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2879974" name="ftn.id2879974"
+ href="#id2879974">53</a>]</sup> {Some fonts may be
+ preloaded in the format file. TeX does not need
+ <tt>TFM</tt> files for those fonts since the metric
+ information is already available.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2880211" name="ftn.id2880211"
+ href="#id2880211">54</a>]</sup> {Older DVI drivers may
+ still use <tt>PXL</tt> files. They are frequently stored
+ in directories with names like <tt>pxl999</tt>.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2880575" name="ftn.id2880575"
+ href="#id2880575">55</a>]</sup> {Actually, <tt>TFM</tt>
+ files contain a little bit more information. The width of
+ a space, the amount of stretch and shrink allowed between
+ words, the amount of extra space allowed after a
+ punctuation mark, and some specialized information used
+ only in fonts for mathematics also appear in the
+ <tt>TFM</tt> files<a id="id2880604" class="indexterm"
+ name="id2880604"></a>. In principle, <tt>TFM</tt> files
+ can contain even more information, although they rarely
+ do. For a complete, detailed description of the
+ information stored in a <tt>TFM</tt> file, consult
+ Appendix F of <span class="emphasis"><em>The
+ TeXbook</em></span>&#160;[<a
+ href="bi01.html#kn:texbook">kn:texbook</a>] and <span
+ class="emphasis"><em>{The TF To PL
+ Processor}</em></span>&#160;[<a
+ href="bi01.html#texware:tftopl">texware:tftopl</a>].}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2880810" name="ftn.id2880810"
+ href="#id2880810">56</a>]</sup> {This is true even if
+ your computer's natural character set is not ASCII. It is
+ the responsibility of the implementor to map the
+ computer's natural character set into ASCII.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2881782" name="ftn.id2881782"
+ href="#id2881782">57</a>]</sup> {Actually, for math
+ fonts, TeX requires several metrics that are not usually
+ provided. <b>afm2tfm</b><a id="id2881795"
+ class="indexterm" name="id2881795"></a> has options which
+ allow you to specify these extra metrics when you convert
+ the <tt>AFM</tt> file.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2882138" name="ftn.id2882138"
+ href="#id2882138">58</a>]</sup> {If your MetaFont
+ distribution does not include a <span
+ class="emphasis"><em>tfmonly</em></span> mode, you can
+ find one in the <tt>modes.mf</tt> file on CTAN. Consult
+ Chapter&#160;<a href="ch11.html"
+ title="Chapter&#160;11.&#160;Introducing MetaFont">Chapter&#160;11</a>,
+ <span class="emphasis"><em><a href="ch11.html"
+ title="Chapter&#160;11.&#160;Introducing MetaFont">Chapter&#160;11</a></em></span>,
+ for more information.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2883176" name="ftn.id2883176"
+ href="#id2883176">59</a>]</sup> {This doesn't mean that
+ every size you want is available. See the section
+ &#8220;<a href="ch05.html#sec.fonts.defnfss2"
+ title="Selecting Fonts with the New Font Selection Scheme">
+ the section called &#8220;Selecting Fonts with the New
+ Font Selection Scheme&#8221;</a>&#8221; for information
+ about defining font sizes in the NFSS.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2855832" name="ftn.id2855832"
+ href="#id2855832">60</a>]</sup>
+ &#8220;$\backslash$<tt>fontshape{it}</tt>$\backslash$<tt>selectfont</tt>&#8221;</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2855948" name="ftn.id2855948"
+ href="#id2855948">61</a>]</sup> {One possible use of
+ loading options is to inhibit hyphenation in fixed-width
+ fonts intended for use in verbatim material. The loading
+ options <tt>{\ hyphenchar\ font=-1}</tt> have this
+ effect.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2884721" name="ftn.id2884721"
+ href="#id2884721">62</a>]</sup> {The only reason that
+ sizes less than 8pt need to be declared at all is that
+ marginal notes (used for editorial comments while the
+ book was in revision) were set in 5pt, and the logo font
+ occasionally turned up in a marginal note.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2885254" name="ftn.id2885254"
+ href="#id2885254">63</a>]</sup> {Under earlier versions
+ of the NFSS, this problem actually resulted in an error
+ rather than a warning. If you wish, you can simply ignore
+ the warning; you no longer have to fix the problem.</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2885536" name="ftn.id2885536"
+ href="#id2885536">64</a>]</sup> {Actually, you can
+ declare a scaling factor in any font declaration,
+ although it seems to make less sense for non-PostScript
+ fonts.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2885557" name="ftn.id2885557"
+ href="#id2885557">65</a>]</sup> {Usually, scaling fonts
+ to the same x-height makes them look acceptable together,
+ but depending on the particular fonts involved, a little
+ more or a little less scaling may be required to achieve
+ a pleasant balance.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2886286" name="ftn.id2886286"
+ href="#id2886286">66</a>]</sup> {In some special versions
+ of TeX, notably those for handling languages like
+ Japanese, this may be extended to a much larger number,
+ but the problem is the same.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2886706" name="ftn.id2886706"
+ href="#id2886706">67</a>]</sup> {For a complete
+ description, consult <span class="emphasis"><em>{The VP
+ To VF Processor}</em></span>&#160;[<a
+ href="bi01.html#texware:vptovf">texware:vptovf</a>] and
+ <span class="emphasis"><em>{The VF to VP
+ Processor}</em></span>&#160;[<a
+ href="bi01.html#texware:vftovp">texware:vftovp</a>].}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2886754" name="ftn.id2886754"
+ href="#id2886754">68</a>]</sup> {Version 2 of NFSS
+ includes &#8220;encoding&#8221; as a parameter in font
+ selection. In the long run, this will allow macro writers
+ to hide many of these difficulties, dramatically reducing
+ the burden currently placed on the user.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2887038" name="ftn.id2887038"
+ href="#id2887038">69</a>]</sup> {You can retrieve the
+ <b>fontinst</b> package from the CTAN archives in the
+ directory <tt>fonts/utilities/fontinst</tt>.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2887238" name="ftn.id2887238"
+ href="#id2887238">70</a>]</sup> {It's still a bit
+ tedious, at least on slow machines, but now you can walk
+ away and get a cup of coffee ;-). All the fonts will be
+ built automatically.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2887312" name="ftn.id2887312"
+ href="#id2887312">71</a>]</sup> {Recent versions of TeX
+ derived from the \Web2C package can build <tt>TFM</tt>
+ files automatically as well.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2887500" name="ftn.id2887500"
+ href="#id2887500">72</a>]</sup> {OK, so not <span
+ class="emphasis"><em>every</em></span> example in this
+ book is in <b>Perl</b>.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2888068" name="ftn.id2888068"
+ href="#id2888068">73</a>]</sup> {Before you use these
+ &#8220;free&#8221; fonts, be aware that many are of
+ questionable legality.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2888196" name="ftn.id2888196"
+ href="#id2888196">74</a>]</sup> {PostScript fonts for the
+ Macintosh are stored in <tt>PFB</tt> format (essentially)
+ in the resource fork of the printer font file. The metric
+ information is stored in the screen font, which also
+ contains bitmaps for on-screen display.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2888763" name="ftn.id2888763"
+ href="#id2888763">75</a>]</sup> {The Nimbus fonts
+ actually come with <tt>TFM</tt> and <tt>VF</tt> files
+ which makes some of the following steps redundant. But
+ because most fonts <span
+ class="emphasis"><em>don't</em></span> come with TeX
+ metrics, the example is important.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2889026" name="ftn.id2889026"
+ href="#id2889026">76</a>]</sup> {Raw <tt>TFM</tt> files
+ used to be identified with an &#8220;r&#8221; prefix, but
+ recently the trend has turned towards a &#8220;0&#8221;
+ suffix. For a more complete discussion of font names,
+ consult <span class="emphasis"><em>Filenames for
+ Fonts</em></span>&#160;[<a
+ href="bi01.html#tug:filenames-fonts">tug:filenames-fonts</a>].}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2889655" name="ftn.id2889655"
+ href="#id2889655">77</a>]</sup> {Some spooling software
+ will transparently handle these problems (by downloading
+ fonts that you forget) if the fonts are available.}</p>
+ </div>
+
+ <div class="footnote">
+ <p><sup>[<a id="ftn.id2889816" name="ftn.id2889816"
+ href="#id2889816">78</a>]</sup> {This step isn't
+ necessary when using a PostScript printers because the
+ PostScript font always contains all the glyphs. The font
+ created by <b>ps2pk</b> will only contain the characters
+ in a single encoding.}</p>
+ </div>
+ </div>
+ </div>
+
+ <div class="navfooter">
+ <table width="100%" summary="Navigation table">
+ <tr>
+ <td width="40%" align="left"><a
+ title="Part&#160;II.&#160;Elements of a Complex Document"
+ href="pt02.html"><img src="figures/nav-prev.png"
+ alt="Prev" border="0" /></a>&#160;</td>
+
+ <td width="20%" align="center"><a title="Making TeX Work"
+ href="index.html"><img src="figures/nav-home.png"
+ alt="Home" border="0" /></a></td>
+
+ <td width="40%" align="right">&#160;<a
+ title="Chapter&#160;6.&#160;Pictures and Figures"
+ href="ch06.html"><img src="figures/nav-next.png"
+ alt="Next" border="0" /></a></td>
+ </tr>
+
+ <tr>
+ <td width="40%" align="left">Part&#160;II.&#160;Elements
+ of a Complex Document&#160;</td>
+
+ <td width="20%" align="center"><a
+ title="Part&#160;II.&#160;Elements of a Complex Document"
+ href="pt02.html"><img src="figures/nav-up.png" alt="Up"
+ border="0" /></a></td>
+
+ <td width="40%" align="right">
+ &#160;Chapter&#160;6.&#160;Pictures and Figures</td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
+