PSFC Home Library Home Index Site Map Contact Us     Search Library
logo   MIT Plasma Science & Fusion Center
 

Instructions for PSFC Authors: TeX to PDF via DVIPS

Printable view
PSFC Library

Creating quality Adobe PDF files from TeX with DVIPS

Table of Contents
  • Backgound 
  • Using Type 1 Fonts with DVIPS
  • Creating the Font Map File 
  • Referencing the Font Map File 
  • Using a Font Map File On a Per-Job Basis  
  • Converting a Postscript Language File to PDF Using Acrobat Distiller  
  • Forcing Font Subsetting
  • Checking the PDF File 
  • Reference and Resources  
  • Terms & Concepts

  • Documents converted from the TeX typesetting language into the Adobe PostScript language or Acrobat Portable Document format (PDF) files usually contain fixed-resolution bitmap fonts that do not print or display well on a variety of printer and computer screens. 

    This document explains how to configure Tomas Rokicki's DVIPS program to use  device-independent, scalable fonts in a PostScript language file or PDF document to
    achieve optimal font quality on any output device. 

     

    BACKGROUND

    The PostScript language can represent fonts in a number of different formats. PostScript Type 3 fonts can be described as either resolution-specific bitmaps or scalable outlines. PostScript Type 1 fonts are resolution-independent outline fonts that can be quickly rasterized by the font machinery in Adobe PostScript interpreters and software that uses the Adobe Type Manager (ATM) font rasterizer. Type 1 fonts can contain "hints" that tell the font machinery how to most effectively rasterize the font even at low resolutions or small font sizes. 


    The Computer Modern fonts, commonly used with Donald Knuth's TeX typesetting language, are typically rendered as fixed-resolution bitmaps (in TeX's PK format)
    even though they were derived from device-independent descriptions in Knuth's METAFONT language. A driver pro-gram translates TeX's DVI file and PK fonts to a
    printer-specific font format for printing. 

    The default behavior of DVIPS is to convert the PK fonts into Type 3 bitmapped fonts when creating a PostScript language file. The resulting PostScript language file thus contains resolution-specific Type 3 bitmapped fonts that are not device- and resolution-independent like scal-able Type 1 fonts. 

    If the PostScript language file is sent to a specific printer, device dependence may not be a problem. If the file is sent to printers of varying resolutions, however, this
    may be a problem because the fonts will not print at the native resolution of the printer. Sending a file with 300 dot-per-inch (dpi) fonts to a 600 dpi printer produces output no better than that of a 300 dpi printer. 

    Similar problems occur when the PostScript language file is converted to Adobe Portable Doc-ument Format (PDF). Since a PDF file is designed to be viewed and
    printed on a wide range of devicesincluding both computer monitors and printers of varying resolutions, it works most effectively with scalable outline fonts. 

    Although Adobe Acrobat Distiller will convert a PostScript language file with bitmapped fonts into PDF, these fonts display slowly and do not render well on screen in the resulting PDF file. But, if you use Type 1 versions of the fonts you will get a compact file format that delivers the optimal font quality when used with any display screen, zoom mode, or printer resolution. 

    1 The information on DVIPS is based primarily on DVIPS version 5.55 for Unix. Other versions may differ -- check the documentation provided with your version of DVIPS for more information. 
    USING TYPE 1 FONTS WITH DVIPS
    The default behavior of Rokicki's DVIPS is to embed Type 3 bitmapped fonts. 

    You can configure DVIPS to not embed bitmapped fonts by performing two steps: 

    1. Create a font map file to identify the fonts you do not want to embed. 
    2. Tell DVIPS how to reference the font map file. 
    You can tell DVIPS to use Type 1 fonts automatically for all of your DVIPS jobs or manually on a per-job basis depending on how you reference the font map file.
    Your system administrator can also configure DVIPS to automatically use Type 1 fonts globally for all users. 

    In each case you have the option to replace the Type 3 bitmapped fonts with references to the Type 1 fonts or to actually embed the code for the Type 1 fonts. The former creates smaller files, but requires the fonts to be available when the PostScript language file is printed or dis-tilled. If the fonts are embedded in the PostScript language file, you don't need to worry about whether the fonts are present in the printer or available to Acrobat Distiller, but youll have a larger PostScript language file and you may encounter memory limitations in certain Post-Script implementations. 

    You need access to the Type 1 versions of the fonts you use in your documents in order to embed the font information. Type 1 versions of the Computer Modern fonts are available in the BaKoMa collection (see "References and Resources") and from commercial type vendors. 

    Before distributing files with embedded fonts, consult the license agreement for your font package.  Some typeface vendors do not allow you to embed complete fonts into a PDF or Post-Script language file for public distribution. Contact the type vendor for more information. You may embed all fonts included in the Adobe Type library. 

    CREATING THE FONT MAP FILE
    To tell DVIPS to use Type 1 fonts rather than Type 3 fonts, you first need to create a font substitution, or font map file, that lists the names of the fonts that DVIPS should not embed as bitmaps. 

    For example, to instruct DVIPS to not embed the standard Computer Modern fonts, the font map file would look as follows: 
     

    cmb10 
    cmbsy10 
    cmbsy6 
    cmbsy7 
    cmbsy8 
    cmbsy9 
    cmbx10 
    cmbx12 


    This example assumes that the PostScript language names of the fonts (as referenced by the PostScript language interpreter's findfont operator) are identical to the names of the TFM files used by TeX (as is the case with the BaKoMa fonts). 

    If the PostScript language name for the font differs from the name used by TeX, use the font map file to create aliases to map the TeX name to the PostScript language name of the font. For example, if the Type 1 version of the CM fonts use upper case names, the font map would look like this: 

    cmb10 CMB10 
    cmbsy10 CMBSY10 
    cmbsy6 CMBSY6 
    cmbsy7 CMBSY7 
    cmbsy8 CMBSY8 
    cmbsy9 CMBSY9 
    cmbx10 CMBX10 
    cmbx12 CMBX12 
    . . 
    . . 
    . . 
    If you use other PostScript language fonts you can also use this alias feature to map the names of the PostScript language fonts to the names of the TeX font files, such
    as: 
    hlvr Helvetica 
    hlvo Helvetica-Oblique 
    hlvb Helvetica-Bold 
    hlvbo Helvetica-BoldOblique 
    . . 
    . . 
    . . 
    Here the font file known to TeX as hlvr (the name of the TFM file) refers to the PostScript language font Helvetica, hlvo refers to Helvetica-Oblique, and so on. 

    In the previous three examples, only the names of the fonts are embedded in the PostScript language file, so the fonts must be available to the PostScript language
    interpreter when the file is printed or distilled. 

    To embed the code for the Type 1 font in the PostScript language file, add "<" followed by the path to the font file in either PFB or PFA format. 

    For example, if you have PFB versions of the CM fonts in the directory /usr/local/lib/tex/fonts/type1/, your font map file would look like: 

    cmb10 </usr/local/lib/tex/fonts/type1/cmb10.pfb 
    cmbsy10 </usr/local/lib/tex/fonts/type1/cmbsy10.pfb 
    cmbsy6 </usr/local/lib/tex/fonts/type1/cmbsy6.pfb 
    cmbsy7 </usr/local/lib/tex/fonts/type1/cmbsy7.pfb 
    cmbsy8 </usr/local/lib/tex/fonts/type1/cmbsy8.pfb 
    cmbsy9 </usr/local/lib/tex/fonts/type1/cmbsy9.pfb 
    cmbx10 </usr/local/lib/tex/fonts/type1/cmbx10.pfb 
    cmbx12 </usr/local/lib/tex/fonts/type1/cmbx12.pfb 
    . . 
    . . 
    . . 


    How the font substitutions specified in your font map file affect your DVIPS jobs depends on how you reference the font map file, as described in the next section. 


    REFERENCING THE FONT MAP FILE

    You can configure DVIPS to make these font substitutions automatically for all of your DVIPS jobs or manually on a per-job basis. Your system administrator can also
    configure DVIPS to automatically use Type 1 fonts globally for all users by placing the font map entries described above in the DVIPS system-wide psfonts.map file. 

    Using a Font Map File Automatically for All Jobs 
    To configure DVIPS to automatically perform the font substitutions for all jobs, create a font map file and then create a file in your home directory named .dvipsrc
    containing the line: 

    p +fontmap.map 
    where fontmap.map is the name of your font map file. (Make sure the p parameter is lowercase.) 

    With some implementations of DVIPS you may need to specify the full path to the font map file. For example, if your home directory is /users/kmw/ and your font map file is called embedCM.map, you would add the following line to your .dvipsrc file: 

    p +/users/kmw/embedCM.map 
    The plus sign (+) before the name of the font map file indicates that the font map file is refer-enced after the system-wide psfonts.map file and any assignments in your font map file are in addition to (and will override) those found in the psfonts.map file. 

    Now you can run DVIPS as usual: 

    dvips dvifilename 
    The font substitutions in your font map file will be used for all your DVIPS jobs. 
    USING A FONT MAP FILE ON A PER-JOB BASIS 
    If you want to frequently switch between font map files, rather than editing your .dvipsrc file each time, you can create one or more printer-specificor, in this case,
    "output-specific" configuration files named config.printername that tell DVIPS to reference different font map files. You can then reference a specific configuration file
    by using the uppercase P parameter with the DVIPS command: 
    dvips -P printername dvifilename 
    For example, you can have a file CM.map like the first three examples that only places references to the fonts in the PostScript language file and another file
    embedCM.map that includes the font code as in the last example shown. 

    Then create a file named config.distiller containing a line with the lowercase p parameter that specifies the file CM.map: 

    p +CM.map 
    and a file named config.distillembed with the line that specifies the file embedCM.map: 
    p +embedCM.map 
    In some implementations of DVIPS you may need to give the complete path to the font map file. 

    The following command line would then create a PostScript language file containing only the names of the fonts: 

    dvips -P distiller dvifilename 
    The following command line would similarly create a PostScript language file with the actual font code embedded in the PostScript language file: 
    dvips -P distillembed dvifilename 
    Depending on how your implementation of DVIPS is configured, DVIPS may look for the config.printername file only in the current directory or in both the current
    directory and your home directory. If you want to change how DVIPS looks for configuration files, you can set the TEXCONFIG environment variable as described in the "Environment Variables" section of the DVIPS documentation. 
    CONVERTING A POSTSCRIPT LANGUAGE FILE TO PDF USING ACROBAT DISTILLER
    Once you've created a PostScript language file, use Acrobat Distiller to convert the PostScript language file to a PDF file. For more detailed information, refer to the Acrobat Distiller Online Guide. 

    If you embedded the Type 1 font code in the PostScript language file created by DVIPS, you can simply distill the PostScript language file as usual. If you embedded
    only references to the Type 1 fonts, you need to make sure Acrobat Distiller has access to the PostScript language fonts. See "Giving Acrobat Distiller access to fonts" in the Acrobat Distiller Online Guide. 
     

    FORCING FONT SUBSETTING
    Acrobat Distiller 2.1 provides configuration settings to enable both font embedding and font subsetting in a PDF file. For more information on these options see
    Embedding fonts in the Acrobat Distiller Online Guide. 

    Acrobat Distiller's default maximum subsetting threshold is 10%. In other words, if more than 10% of the characters in a font are included in the document, the entire font is embedded in the document. 

    You may want to change this setting to a higher value. This can produce a smaller PDF file and you may be required by the font vendor's license to subset the font if
    you plan to distribute the PDF file (contact the font vendor for details). 

    You can change the threshold for font embedding by adding a line to the Example.ps file in Acrobat Distiller's startup directory. In UNIX, the file is called DStartup.ps
    and is located in <installdir>/custom. 

    For example, to change the embedding threshold to the maximum value of 99 percent, open Example.ps with a text editor and add the following line to the file: 

    << /SubsetFonts true /MaxSubsetPct 99 >> setdistillerparams 
    Although it doesn't matter where in the file you put this line, it's a good idea to place it in the "FONT EMBEDDING" section. 

    Save this file, restart Acrobat Distiller, and create the PDF file as usual. In most cases, all of the embedded fonts will now be subsetted. 

    If you later want to restore the original default setting, simply comment out this line by preceding it with a percent sign (%) and restart Acrobat Distiller. 


    CHECKING THE PDF FILE
    If you've been using Type 3 bitmapped fonts in your PDF files, you'll see the difference the Type 1 fonts make as soon as you open the file in Acrobat Reader or Exchange. With scalable Type 1 fonts the file displays more quickly and can be viewed in any zoom mode with no loss of font quality.  Furthermore, you can print the PDF file on any printer and the fonts will be rendered at the maximum resolution of the printer. 

    If your document uses fonts that are not referenced in your font map file (but are available on your system in the standard TeX PK format) it may still include Type 3
    fonts. The BaKoMa col-lection, for example, does not have the manfnt font typically used to typeset the METAFONT logo, and documents using this font will continue to include this as a bitmapped font. 

    Although the differences between the Type 3 bitmap fonts and the Type 1 fonts are usually apparent upon inspection, you can check which fonts are used in a PDF file by selecting File > Document Info > Fonts in Acrobat Reader or Exchange. From the Font Info window click List All Fonts. 

    The Type column will display whether the fonts are Type 1 or Type 3. If you're using DVIPS the Type 3 bitmapped fonts will also be named T1, T2, etc., while Type 1 fonts will display their correct names, such as cmr10, cmbx10, and so on. Fonts that have a six-character prefix added to the font name (such as KICOLA+cmr7) are Type 1 fonts that have been subsetted. 


    REFERENCES AND RESOURCES
     

    CTAN: the Comprehensive TeX Archive Network :  CTAN provides the most complete and up-to-date TeX-related software. 

    TeX Fonts in ATM Compatible Type 1 Font Format from The BaKoMa collection are available here and from CTAN .

    Dvips: A DVI-to-PostScript Translator by Tomas Rokicki: 

    TeX is described in The TeXbook by Donald Knuth, published by Addison-Wesley Publishing Company.  See Amazon.com's listing & review of this book by clicking here .

    Getting Good PDF from LaTeX by Chris Rost

    T1part: Printing TEX Documents with Partial Type 1 Fonts by Sergey Lesenko
     

    TERMS AND CONCEPTS 
    BaKoMa fonts: The BaKoMa Fonts Collection from Basil K. Malyshev includes Type 1 versions of the basic Computer Modern fonts. The BaKoMa fonts are available from the comprehensive TeX Archive Network (CTAN).

    DVI: The "device-independent" file format used by TeX as an intermediate file between the TeX source code and a printer-specific output file. The TeX program
    converts TeX source code into a DVI file. A driver program then converts the DVI file into another format for viewing or printing.  DVIPS, for example, converts a
    DVI file into a PostScript language file which can then be printed on a PostScript language printer or converted to PDF using Acrobat Distiller. 

    DVIPS: A DVI print driver written by Tomas Rokicki that converts a TeX DVI file into a Post-Script file.  Click here for Dvips: A DVI-to-PostScript Translator

    PDF: The "Portable Document Format" (PDF) is the native file format of the Adobe Acrobat family of products. The goal of PDF is to enable users to easily and
    reliably exchange and view electronic documents independent of the environment in which they were created. The imag-ing model underlying PDF is based on Adobe
    PostScript language, but contains additional fea-tures to display, navigate, and annotate electronic documents. 

    The PDF file format is documented in the Portable Document Format Reference Manual by Tim Bienz and Richard Cohn, published by Addison-Wesley Publishing
    Company. 

    Adobe Systems' Technical Note 5156, "Updates to the Portable Document Format" contains additional information and is available on the Adobe web site.

    PFA: "Printer Font ASCII" -- an ASCII (text-only) encoding of a PostScript Type 1 font. 

    PFB: "Printer Font Binary" -- a binary encoding of a PostScript Type 1 font 

    PK Font: A bitmapped font in TeXs "packed" format. Although many PK fonts are derived from device-independent descriptions in the METAFONT language, a PK
    font is a device- and resolution-specific bitmap. When a driver program (such as DVIPS) converts a TeX DVI file to a printer-specific format, it typically converts the PK font into a printer-specific bitmapped font format (such as a PostScript Type 3 bitmapped font). 

    TeX: A typesetting language written by Donald Knuth. 

    TFM: A TeX font metric (TFM) file contains information about a font's character widths, liga-tures, and kerning pairs (but not the actual shapes of the fonts, which are typically stored in a PK file). The TFM file is used by the TeX program to typeset the document and create a TeX DVI file. 
     
     

    Adobe, the Adobe logo, Adobe Acrobat, Adobe Type Manager, ATM, and PostScript are trademarks and Adobe is a service mark of Adobe Systems Incorporated which may be registered in certain jurisdictions. All other products mentioned in this document are trademarked or copyrighted by their respective owners. Copyright 1996 Adobe Systems Incorporated. All rights reserved. 

    Top