This is Info file dvips.info, produced by Makeinfo version 1.67 from the input file dvips.texi. INFO-DIR-SECTION TeX START-INFO-DIR-ENTRY * DVI-to-Postscript: (dvips). Translating TeX DVI files to PostScript. * afm2tfm: (dvips)Invoking afm2tfm. Making Type 1 fonts available to TeX. * dvips: (dvips)Invoking dvips. DVI-to-PostScript translator. END-INFO-DIR-ENTRY  File: dvips.info, Node: Metric files, Next: Glyph files, Up: Font concepts Metric files ------------ A "metric file" describes properties of the font that are independent of what the characters actually look like. Aside from general information about the font itself, a metric file has two kinds of information: information about individual characters, organized by character code, and information about sequences of characters. The per-character information specifies the width, height, depth, and italic correction of each character in the font. Any might be zero. In addition to information on individual characters, the metric file specifies "kerning", i.e., adding or removing space between particular character pairs. It further specifies "ligature" information: when a sequence of input characters should be typeset as a single (presumably different) "ligature" character. For example, it's traditional for the input `fi' to be typeset as `fi', not as `fi' (with the dot of the `i' colliding with `f'). (In English, the only common ligatures are fi, fl, ff, ffi, and ffl.) Different typesetting systems use different metric file formats: * Each Postscript font has an "Adobe font metrics" (`.afm') file. These files are plain text, so you can inspect them easily. You can get AFM files for Adobe's fonts from `ftp://ftp.adobe.com/pub/adobe/Fonts/AFMs'. * TeX uses "TeX font metrics" (`.tfm') files. When you say `\font = FONT' in your TeX document, TeX reads a file named `FONT.tfm'. (Well, except for the `texfonts.map' feature; *note Fontmap: (kpathsea)Fontmap.). TeX can then calculate the space occupied by characters from the font when typesetting. In addition, the DVI drivers you use to print or view the DVI file produced by TeX may need to look at the TFM file. TFM files are binary (and hence are typically much smaller than AFM files). You can use the `tftopl' program (*note tftopl invocation: (web2c)tftopl invocation.) that comes with TeX to transform a TFM file into a human-readable "property list" (`.pl') file. You can also edit a PL file and transform it back to a TeX-readable TFM with the companion program `pltotf' (*note pltotf invocation: (web2c)pltotf invocation.). Editing metrics by hand is not something you're likely to want to do often, but the capability is there. * ATM and other typesetting systems use "printer font metric" (`.pfm') files. These are binary files. They are irrelevant in the TeX world, and not freely available, so we will not discuss them further. The Afm2tfm program distributed with Dvips converts an AFM file to a TFM file and performs other useful transformations as well. *Note Invoking afm2tfm::.  File: dvips.info, Node: Glyph files, Next: Virtual fonts, Prev: Metric files, Up: Font concepts Glyph files ----------- Although a metric file (see the previous section) contains information about the spatial and other properties of the character at position 75, say, it contains nothing about what the character at position 75 actually looks like. The glyphs--the actual shapes of the letterforms in a font--are defined by other files, which we call glyph files. TeX itself only reads the TFM file for a font; it does not need to know character shapes. A "glyph file" is a file that defines the shapes of the characters in a font. The shapes can be defined either by outlines or by bitmaps. PostScript fonts are defined as "outline fonts": Each character in the font is defined by giving the mathematical curves (lines, arcs, and splines) that define its contours. Different sizes of a character are generated by linearly scaling a single shape. For example, a 10-point `A' is simply half the size of a 20-point `A'. Nowadays, outline fonts usually also contain "hints"--additional information to improve the appearance of the font at small sizes or low resolutions. Although various kinds of PostScript outline fonts exist, by far the most common, and the only one we will consider, is called "Type 1". The glyph files for Postscript Type 1 fonts typically have names ending in `.pfa' ("printer font ASCII") or `.pfb' ("printer font binary"). In contrast, glyph files for Computer Modern and the other standard TeX fonts are "bitmap fonts", generated from Metafont (`.mf') descriptions. The Metafont program distributed with TeX generates bitmaps from these descriptions. The glyph files for TeX bitmap fonts are usually stored in "packed font" (PK) files. The names of these files end in `.NNNpk', where NNN is the resolution of the font in dots per inch. For example, `cmr10.600pk' contains the bitmaps for the `cmr10' font at a resolution of 600dpi. (On DOS filesystems, it's more likely `dpi600\cmr10.pk'.) Metafont actually outputs "generic font" (GF) files, e.g., `cmr10.600gf', but the GF files are usually converted immediately to PK format (using the `gftopk' utility that comes with TeX) since PK files are smaller and contain the same information. (The GF format is a historical artifact.)  File: dvips.info, Node: Virtual fonts, Next: Encodings, Prev: Glyph files, Up: Font concepts Virtual fonts ------------- A "virtual font" is constructed by extracting characters from one or more existing fonts and rearranging them, or synthesizing new characters in various ways. The explanation in this manual is intended to suffice for understanding enough about virtual fonts to use them with Dvips. It isn't a reference manual on virtual fonts. For more information: The primary document on virtual fonts is Donald E. Knuth, `TUGboat' 11(1), Apr. 1990, pp. 13-23, "Virtual Fonts: More Fun for Grand Wizards" (`CTAN:/info/virtual-fonts.knuth'; for CTAN info, *note unixtex.ftp: (kpathsea)unixtex.ftp.). (Don't be intimidated by the subtitle.) A virtual font (`.vf') file specifies, for each character in the virtual font, a recipe for typesetting that character. A VF file, like a TFM file, is in a compressed binary format. The `vftovp' and `vptovf' programs convert a VF file to a human-readable VPL (virtual property list) format and back again. *Note vftovp invocation: (web2c)vftovp invocation, and *Note vptovf invocation: (web2c)vptovf invocation. In the case of a PostScript font F being used in a straightforward way, the recipe says: character I in the VF font is character J in font F. The font F is called a "base font". For example, the VF file could remap the characters of the PostScript font to the positions where TeX expects to find them. *Note Encodings::. Since TeX reads only TFM files, not VF's, each VF must have a corresponding TFM for use with TeX. This corresponding TFM is created when you run `vptovf'. You can "expand" virtual fonts into their base fonts with DVIcopy (*note dvicopy invocation: (web2c)dvicopy invocation.). This is useful if you are using a DVI translator that doesn't understand vf's itself.  File: dvips.info, Node: Encodings, Next: PostScript typesetting, Prev: Virtual fonts, Up: Font concepts Encodings --------- Every font, whatever its type, has an "encoding", that specifies the correspondence between "logical" characters and character codes. For example, the ASCII encoding specifies that the character numbered 65 (decimal) is an uppercase `A'. The encoding does not specify what the character at that position looks like; there are lots of ways to draw an `A', and a glyph file (*note Glyph files::.) tells how. Nor does it specify how much space that character occupies; that information is in a metric file (*note Metric files::.). TeX implicitly assumes a particular encoding for the fonts you use with it. For example, the plain TeX macro `\'', which typesets an acute accent over the following letter, assumes the acute accent is at position 19 (decimal). This happens to be true of standard TeX fonts such as Computer Modern, as you might expect, but it is not true of normal PostScript fonts. It's possible but painful to change all the macros that assume particular character positions. A better solution is to create a new font with the information for the acute accent at position 19, where TeX expects it to be. *Note Making a font available::. PostScript represents encodings as a sequence of 256 character names called an "encoding vector". An "encoding file" (`.enc') gives such a vector, together with ligature and kerning information (with which we are not concerned at the moment). These encoding files are used by the Afm2tfm program. Encoding files are also downloaded to the PostScript interpreter in your printer if you use one of them in place of the default encoding vector for a particular PostScript font. Examples of encodings: the `dvips.enc' encoding file that comes with Dvips in the `reencode' directory is a good (but not perfect) approximation to the TeX encoding for TeX's Computer Modern text fonts. This is the encoding of the fonts that originated with Dvips, such as `ptmr.tfm'. The distribution includes many other encoding files; for example, `8r.enc', which is the base font for the current PostScript font distribution, and three corresponding to the TeX mathematics fonts: `texmext.enc' for math extensions, `texmital.enc' for math italics, and `texmsym.enc' for math symbols.  File: dvips.info, Node: PostScript typesetting, Prev: Encodings, Up: Font concepts How PostScript typesets a character ----------------------------------- The output of Dvips is a program in the PostScript language that instructs your (presumably PostScript-capable) printer how to typeset your document by transforming it into toner on paper. Your printer, in turn, contains a PostScript interpreter that carries out the instructions in this typesetting program. The program must include the definition of any PostScript fonts that you use in your document. Fonts built into your printer (probably the standard 35: `Times-Roman', `ZapfDingbats', ...) are defined within the interpreter itself. Other fonts must be downloaded as pfa or pfb files (*note Glyph files::.) from your host (the computer on which you're running Dvips). You may be wondering exactly how a PostScript interpreter figures out what character to typeset, with this mass of metrics, glyphs, encodings, and other information. (If you're not wondering, skip this section ...) The basic PostScript operator for imaging characters is `show'. Suppose you've asked TeX to typeset an `S'. This will eventually wind up in the Dvips output as the equivalent of this PostScript operation: (S) show Here is how PostScript typesets the `S': 1. PostScript interpreters use ASCII; therefore `S' is represented as the integer 83. (Any of the 256 possible characters representable in a standard 8-bit byte can be typeset.) 2. A PostScript "dictionary" is a mapping of names to arbitrary values. A font, to the interpreter, is a dictionary which contains entries for certain names. (If these entries are missing, the interpreter refuses to do anything with that font.) PostScript has a notion of "the current font"--whatever font is currently being typeset in. 3. One of the mandatory entries in a font dictionary is `Encoding', which defines the encoding vector (*note Encodings::.) for that font. This vector of 256 names maps each possible input character to a name. 4. The interpreter retrieves the entry at position 83 of the encoding vector. This value is a PostScript name: `/S'. 5. For Type 1 fonts (we're not going to discuss anything else), the interpreter now looks up `/S' as a key in a dictionary named `CharStrings', another mandatory entry in a font dictionary. 6. The value of `S' in `CharStrings' is the equivalent of a series of standard PostScript commands like `curveto', `lineto', `fill', and so on. These commands are executed to draw the character. There can also be "hint information" that helps adapt the character to low-resolution rasters. (*Note Glyph files::.) The commands are actually represented in a more compact way than standard PostScript source; see the Type 1 book for details. This method for typesetting characters is used in both Level 1 and Level 2 PostScript. See the PostScript reference manuals for more information.  File: dvips.info, Node: Making a font available, Next: Invoking afm2tfm, Prev: Font concepts, Up: PostScript fonts Making a PostScript font available ================================== To make a PostScript font available in a TeX document, you need to install the font on your system and then define it within the document. Once you have installed the font, of course, it is available for any document thereafter and you don't need to reinstall it. You must have an AFM file for any font you install. Unless the font is built into your printer, you must also have a PFA or PFB file. In the following examples, we use the font `Times-Roman' to illustrate the process. But you should use the prebuilt fonts for Times and the other standard fonts, rather than rebuilding them. The prebuilt fonts are made using a more complicated process than that described here, to make them work as well as possible with TeX. So following the steps in this manual will not generate files identical to the distributed ones. *Note PostScript font installation::, for pointers to the prebuilt fonts. Installation of a PostScript font proceeds in three steps. *Note Font concepts::, for descriptions of the various files involved. 1. Run `afm2tfm' to create a TFM file for the original font, and the VPL form of the virtual font: afm2tfm Times-Roman -v ptmr rptmr 2. Run `vptovf' to generate a VF and TFM file for the virtual font from the VPL file: vptovf ptmr.vpl ptmr.vf ptmr.tfm 3. Insert an entry for the font in `psfonts.map' (*Note psfonts.map::): rptmr Times-Roman ' signs, you can make the ligature scanning operation skip that many resulting characters before proceeding. This works just like in Metafont. For example, the `fi' ligature is specified with `f i =: fi ;'. A more convoluted ligature is `one one |=:|>> exclam ;' which separates a pair of adjacent `1''s with an exclamation point, and then skips over two of the resulting characters before continuing searching for ligatures and kerns. You cannot give more >'s than |'s in an ligature operation, so there are a total of eight possibilities: =: |=: |=:> =:| =:|> |=:| |=:|> |=:|>> The default set of ligatures and kerns built in to Afm2tfm is: % LIGKERN question quoteleft =: questiondown ; % LIGKERN exclam quoteleft =: exclamdown ; % LIGKERN hyphen hyphen =: endash ; endash hyphen =: emdash ; % LIGKERN quoteleft quoteleft =: quotedblleft ; % LIGKERN quoteright quoteright =: quotedblright ; % LIGKERN space {} * ; * {} space ; 0 {} * ; * {} 0 ; % LIGKERN 1 {} * ; * {} 1 ; 2 {} * ; * {} 2 ; 3 {} * ; * {} 3 ; % LIGKERN 4 {} * ; * {} 4 ; 5 {} * ; * {} 5 ; 6 {} * ; * {} 6 ; % LIGKERN 7 {} * ; * {} 7 ; 8 {} * ; * {} 8 ; 9 {} * ; * {} 9 ;  File: dvips.info, Node: Special font effects, Next: Afm2tfm options, Prev: Changing font encodings, Up: Invoking afm2tfm Special font effects -------------------- Besides the reencodings described in the previous section, Afm2tfm can do other manipulations. (Again, it's best to use the prebuilt fonts rather than attempting to remake them.) `-s SLANT' makes an obliqued variant, as in: afm2tfm Times-Roman -s .167 -v ptmro rptmro This creates `ptmro.vpl' and `rptmro.tfm'. To use this font, put the line rptmro Times-Roman ".167 SlantFont" into `psfonts.map'. Then `rptmro' (our name for the obliqued Times) will act as if it were a resident font, although it is actually constructed from Times-Roman via the PostScript routine `SlantFont' (which will slant everything 1/6 to the right, in this case). Similarly, you can get an expanded font with afm2tfm Times-Roman -e 1.2 -v ptmrre rptmrre and by recording the pseudo-resident font rptmrre Times-Roman "1.2 ExtendFont" in `psfonts.map'. You can also create a small caps font with a command such as afm2tfm Times-Roman -V ptmrc rptmrc This will generate a set of pseudo-small caps mapped into the usual lowercase positions and scaled down to 0.8 of the normal cap dimensions. You can also specify the scaling as something other than the default 0.8: afm2tfm Times-Roman -c 0.7 -V ptmrc rptmrc It is unfortunately not possible to increase the width of the small caps independently of the rest of the font. If you want a really professional looking set of small caps, you need to acquire a small caps font. To change the `PaintType' in a font from filled (0) to outlined (2), you can add `"/PaintType 2 store"' to `psfonts.map', as in the following: rphvrl Helvetica "/PaintType 2 store" Afm2tfm writes to standard output the line you need to add to `psfonts.map' to use that font, assuming the font is resident in the printer; if the font is not resident, you must add the `'), like other downloaded files. Adobe Multiple Master fonts, such as Minion, cannot be partially downloaded. To partially download in general, but avoid partial downloading for individual fonts, use `<<' instead `<': pmnr8r Minion <, the color support has gone through many changes by Tomas Rokicki. Besides the source code support itself, there are additional TeX macro files: `colordvi.tex' and `blackdvi.tex', and corresponding `.sty' versions for use with LaTeX. In this section we describe the use of color from the document preparer's point of view and then add some instructions on installation for the TeX administrator. * Menu: * Color macro files:: TeX macro definitions. * User-definable colors:: Adding your own colors. * Color subtleties:: Subtleties in using color. * Ted Turner:: Printing in black/white after colorizing. * Color device configuration:: Configuring Dvips for color devices. * Color support details:: Color support details  File: dvips.info, Node: Color macro files, Next: User-definable colors, Up: Color Color macro files ================= All the color macro commands are defined in `colordvi.tex' (or `colordvi.sty'). To access these macros simply add to the top of your plain TeX file the command: \input colordvi For (the obsolete) LaTeX 2.09, add the `colordvi' style option as in: \documentstyle[12pt,colordvi]{article} For LaTeX 2e, these examples are not applicable. Instead, please see the documentation for the graphics package, available from `CTAN:doc/latex/graphics/'. See also `CTAN:doc/epslatex.ps'. These macros provide two basic kinds of color macros: ones for local color changes (a few words, a single symbol) and one for global color changes (the whole document). All the color names use a mixed case scheme to avoid conflicts with other macros. There are 68 predefined colors, with names taken primarily from the Crayola crayon box of 64 colors, and one pair of macros for the user to set his own color pattern (*note User-definable colors::.). You can browse the file `colordvi.tex' for a list of the predefined colors. The comments in this file also show a rough correspondence between the crayon names and Pantones. A local color command has the form \COLORNAME{this is the color COLORNAME} where COLORNAME is the name of a predefined color, e.g., `Blue'. As shown, these macros take one argument, the text to print in the specified color. This can be used for nested color changes since it restores the original color state when it completes. For example: This text is normal but here we are \Red{switching to red, \Blue{nesting blue}, recovering the red} and back to original. The color nesting level has no hard limit, but it is not advisable to nest too deeply lest you and the reader lose track of the color history. The global color command has the form \textCOLORNAME These macros take no arguments and changes the default color from that point on to COLORNAME. This of course can be overridden globally by another such command or locally by local color commands. For example, expanding on the example above, we might have \textGreen This text is green but here we are \Red{switching to red, \Blue{nesting blue}, recovering the red} and back to original green. \textCyan The text from here on will be cyan until \Yellow{locally changed to yellow}. Now we are back to cyan. The color commands will even work in math mode and across math mode boundaries. This means that if you have a color before going into math mode, the mathematics will be set in that color as well. In alignment environments like `\halign', `tabular' or `eqnarray', local color commands cannot extend beyond the alignment characters. Because local color commands respect only some environment and delimiter changes besides their own, care must be taken in setting their scope. It is best not to have them stretch too far. At the present time there are no macros for color environments in LaTeX which might have a larger range. This is primarily to keep the TeX and LaTeX use compatible.  File: dvips.info, Node: User-definable colors, Next: Color subtleties, Prev: Color macro files, Up: Color User-definable colors ===================== There are two ways for the user to specify colors not already defined. For local changes, there is the command `\Color' which takes two arguments. The first argument is four numbers between zero and one and specifies the intensity of cyan, magenta, yellow and black (CMYK) in that order. The second argument is the text that should appear in the given color. For example, suppose you want the words "this color is pretty" to appear in a color which is 50% cyan, 85% magenta, 40% yellow and 20% black. You would use the command \Color{.5 .85 .4 .2}{this color is pretty} For global color changes, there is a command `\textColor' which takes one argument, the CMYK quadruple of relative color intensities. For example, if you want the default color to be as above, then the command \textColor{.5 .85 .4 .2} The text from now on will be this pretty color will do the trick. Making a global color change in the midst of nested local colors is highly discouraged. Consequently, Dvips will give you warning message and do its best to recover by discarding the current color history.  File: dvips.info, Node: Color subtleties, Next: Ted Turner, Prev: User-definable colors, Up: Color Color subtleties ================ Color macros are defined via `\special' keywords. As such, they are put in the `.dvi' file only as explicit message strings to the driver. The (unpleasant) result is that certain unprotected regions of the text can have unwanted color side effects. For example, if a color region is split by TeX across a page boundary, then the footers of the current page (e.g., the page number) and the headers of the next page can inherit that color. To avoid this effect globally, users should make sure that these special regions of the text are defined with their own local color commands. For example, to protect the header and footer in plain TeX, use \headline{\Black{My Header}} \footline{\Black{\hss\tenrm\folio\hss}} This warning also applies to figures and other insertions, so be careful! Of course, in LaTeX, this is much more difficult to do because of the complexity of the macros that control these regions. This is unfortunate but inevitable, because TeX and LaTeX were not written with color in mind. Even when writing your own macros, much care must be taken. The macros that `colorize' a portion of the text work prefix the text work by outputting one `\special' command to turn the color on before the text, and outputting another `\special' command afterwards to restore the original color. It is often useful to ensure that TeX is in horizontal mode before the first special command is issued; this can be done by prefixing the color command with `\leavevmode'.  File: dvips.info, Node: Ted Turner, Next: Color device configuration, Prev: Color subtleties, Up: Color Printing in black/white after colorizing ======================================== If you have a TeX or LaTeX document written with color macros and you want to print it in black and white there are two options. On all (good) PostScript devices, printing a color file will print in corresponding gray levels. This is useful to get a rough idea of the colors without using expensive color printing devices. The second option is to replace the call to input `colordvi.tex' with `blackdvi.tex' (and similarly for the `.sty' files). So in the above example, replacing the word `colordvi' with `blackdvi' suffices. `blackdvi.tex' defines the color macros as no-ops, and so will produce normal black/white printing. By this simple mechanism, the user can switch to all black/white printing without having to ferret out the color commands. Also, some device drivers, particularly non-PostScript ones like screen previewers, will simply ignore the color commands and so print in black/white. Hopefully, in the future screen previewers for color displays will be compatible with some form of color support.