APPLICATION NOTE #191 DEVELOPING POSTSCRIPT WIDTH TABLES Rev. 01 The standard XyWrite printer files include font definitions and width tables for the internal fonts supported by PostScript printers. Adobe Systems, Inc. also manufactures and sells a variety of typefaces that can be downloaded to most PostScript printers, but these typefaces are not predefined in the XyWrite printer files. This application note describes the program MAKEPOST.PGM, which helps you develop the font definitions and width tables needed to use downloaded PostScript fonts with XyWrite III Plus. PREPARING TO USE MAKEPOST.PGM First, you must purchase and copy to your computer the Adobe typefaces you want to use. As supplied by Adobe Systems, each typeface has three components: a printer font, a screen font, and an Adobe Font Metric (AFM) file. XyWrite III Plus uses the printer font for printing; it does not use the screen font at all. MAKEPOST.PGM uses the AFM files to produce the necessary font definitions and width tables. To use MAKEPOST.PGM, copy all the font metric files (identified by the .AFM filename extension) for your typefaces to a subdirectory on your hard disk. After you have used MAKEPOST.PGM, you can delete the AFM files, if you wish. Next, you must install the XYQUEST-supplied files listed below: MAKEPOST.PGM The program file PARA.TST Test file GOAL.TST Test file MAKEPOST.PRN Basic printer file ADDPOST.PGM An additional program used to update your current printer file after running MAKEPOST.PGM All five files should be copied to the directory that contains the AFM files. RUNNING MAKEPOST.PGM To run MAKEPOST.PGM, you must load XyWrite III Plus, version 3.54 or later. Once you are in XyWrite, change to the drive and subdirectory where you have stored the AFM files and the program files. For example: Type: F5c: Type: F5cd \postfont Make certain that there is no file open in the current window, and that there is at least one other empty window. Then issue the following command: Type: F5run makepost.pgm Result: The program starts to run. It verifies that the windows are set up properly; that all program files are present; and that there is at least one AFM file present. If all is well, the program presents a list of all AFM files in the subdirectory. You can use the cursor keys to move around this list until the cursor is positioned on an AFM file that corresponds to one of the typefaces you want to use. Press F9 to mark the AFM filename with an asterisk. If you mark one by mistake, move the cursor to that line and press F9 again to "unmark" it. When you have finished marking the list, press F1 to move to the next step. (You can leave the program at any time by pressing Esc.) After you press F1, the program doublechecks the filenames. If all is well, the program starts extracting font information from the first one you checked. This process takes from 1ª5 minutes for each file, depending on the speed of your computer. Most of this work is hidden from view, but a message will appear occasionally telling you how far the program has progressed. Note #1 Program Limit. MAKEPOST.PGM can process up to eight AFM files. If you mark more than eight, the program will ignore any past the first eight. PROGRAM OPERATION The next two sections, "Developing Width Information" and "Constructing Test Files," briefly describe how the program works. This information may be of interest to you, but is not necessary for running the program. However, it is important that you read the sections "Testing the Results" and "Updating Your Regular Printer File" and follow the instructions outlined there. Developing Width Information The AFM files contain a lot of information about each character in the font. The only two pieces that XyWrite cares about are the Adobe description of the character and the character width. XyWrite takes that data and stores it in a temporary file. It then changes the description to the ASCII character XyWrite uses to represent it. Next, it sorts the list in order of character width, converts the Adobe widths to XyWrite widths, and places all characters with the same width on a line together, constructing a XyWrite width table. It also writes a font definition, using standard PostScript coding and XyWrite conventions. This process is repeated for each AFM file you selected. Constructing Test Files After all the selected AFM files have been processed, the program continues by constructing a special test printer file, naming it after the AFM file but assigning a PRN extension (see Note #2). It uses MAKEPOST.PRN as a basis, and adds the font definitions and width tables developed from the AFM files. It also modifies the File Begin (FB<) statement in the printer file to include the proper PostScript coding for the new fonts. Finally, it prepares two test files for printing: GOAL and PARA, using the .TST files as templates. These files can help you confirm that the widths in the test printer file are correct before you add them to your regular printer file. TESTING THE RESULTS The width tables that MAKEPOST.PGM creates might need a bit of fine-tuning. This is because the program must round widths up or down as it computes them, and sometimes the human eye is a better judge than a mathematical formula. Therefore, we recommend that you follow this procedure to doublecheck MAKEPOST.PGM's work: 1. Load the test printer file. MAKEPOST automatically names the test printer file after the first AFM font you selected; this name is displayed at the end of the program. 2. Make sure the PostScript printer is on-line and ready to print from XyWrite. 3. Print GOAL and (optionally) PARA. GOAL will be quite lengthy--several pages for each font. PARA is somewhat shorter. 4. Examine GOAL for places where the right margin is out of alignment. If you find any, make one of the following adjustments: If the line is too short, decrease the width of that character in the test printer file by one or two units and print the file (or section) again. If the line is too long, increase the width of that character in the test printer file by one or two units and print the file (or section) again. After modifying the widths, make sure you store and reload the printer file before printing again. 5. If the widths are still not right, repeat steps 3 and 4 until they are. 6. Use the optional test file, PARA, to confirm that the typefaces justify properly. UPDATING YOUR REGULAR PRINTER FILE The test printer file made by MAKEPOST.PGM includes only the new fonts you specified and a few other basic fonts. You will probably want to integrate the new material for the new fonts into the PostScript printer file you have been using until now (see Notes #3 and #4). To help you do that, XYQUEST provides another small utility, ADDPOST.PGM. To use ADDPOST.PGM: 1. Call the test printer file to window 1. For instance: Type: F5window 1 Type: F5call benguiat.prn 2. Call your regular printer file to window 2. For instance: Type: F5window 2 Type: F5call 3post35n.prn 3. Change back to window 1: Type: F5window 1 4. Run the program: Type: F5run addpost.pgm Result: ADDPOST.PGM confirms that the files are properly positioned. It copies the new width tables and font definitions from the test file to the regular file. It also modifies the File Begin statement to include the new fonts. Note #2 Duplicate Filenames. If MAKEPOST.PGM encounters a filename that already exists, it uses the name XX.PRN for the new file and displays a message recommending that you rename it to something more appropriate. Note #3 Printer File Versions. The program ADDPOST.PGM is designed to work with the following standard printer files: 3POST13.PRN 3POST29.PRN 3POST35C.PRN 3POST35N.PRN 3POST43.PRN If you are using a different PostScript printer file (e.g., 3POSTPLS.PRN), you may encounter justification problems with upper ASCII characters. Note #4 File Begin Statement. If you have significantly changed the File Begin statement in your regular printer file, use ADDPOST.PGM with caution. Double check the results before storing the modified printer file. ADDPOST.PGM is designed to work with File Begin statements that contain the same basic elements of font encoding that standard PostScript printer files contain. Note #4 Text Fonts Only. MAKEPOST.PGM works only on Adobe English-language text fonts. ##