Creating Outline Versions of PostScript Soft Fonts -------------------------------------------------- April 1, 1992 (no joke!) GENERAL DESCRIPTION ------------------- Based on a program found in the PostScript Language Tutorial and Cookbook on pp. 198-201 (also available on CompuServe in the ADOBE forum in DL4 as PS-16C.TXT,) the following procedure describes how to create outline versions of Type 1 soft fonts. The outline soft fonts may then be used with Adobe Type Manager for Windows for use in Windows applications. This procedure does not and cannot alter font outlines resident within the printer. refer to the program and file mentioned above however, to accomplish this by creating a new "semi-resident" font from a resident font. If you have recently made the transition from the DOS/GEM version of Ventura Publisher to VPWin 3.0 or 4.0 as I have, you may have been spoiled by some of the tricks pulled in the PS2.EFF optional prologue file included with the GEM versions that allowed using outline versions of PostScript fonts. This method is not currently possible within Windows, but VPWin 4.0 includes a copy of ATM and 13 of the common Adobe PostScript soft fonts. The procedure takes advantage of two PostScript commands to change the characteristic of the rasterized fonts produced by the printer: namely PaintStyle and StrokeWidth. It does not alter the actual outline information. Because of this fact, some font outlines may produce undesirable results when converted to an outline version. For the most part, sans serif outlines with a heavy stroke weight are the best candidates for outline fonts. Helvetica-Bold and Helvetica-Black, for instance, produce very good results when printed as an outline. This procedure is fairly complicated, and requires a decent understanding of the PostScript command language. A Hex file editor with cut-and-paste features such as the Norton Utilities DiskEdit (formally NU in versions prior to 5.0) is also required. Anyone not comfortable with the thought of tinkering with DOS files at the byte level is best not to attempt this procedure. DISCLAIMER ---------- Strictly speaking, Adobe, and presumably other commercial font vendors explicitly prohibit the modification of soft font files in any way. By way of disclaimer then, the liability for utilizing this procedure with licensed soft fonts falls completely on the licensee of the font, and not the author. Although every effort has been taken to insure the accuracy of the information presented here, the author makes no warranty regarding this material, either expressed or implied, including the implied warranties of merchantibility and the fitness for a particular purpose. In no way shall E A BEHL, its agents or employees, or any party which offers this information; be found liable for any damage; whether direct, incidental, or consequential, actual or potential; resulting from the furnishing, performance, or use of this procedure. INITIAL PREPARATION ------------------- In a nutshell, the procedure copies an existing soft font outline file, the .PFB file; changes the fill to none, and adds an instruction to widen the line drawn around the perimeter of the character outline by the printer. First, create a separate subdirectory and copy the soft font .PFB file which will be used as the outline source into this subdirectory to insure that the original file is not damaged inadvertently. Rename this file to make it unique to the original file. I suggest adding a Z to the file name since this letter is rarely used. As an example, to rename Helvetica-Bold type at the DOS prompt: REN HVB_____.PFB HVBZ____.P Next, create a dummy ASCII file to add to the .PFB to create space for the additional instructions in the file. In most .PFB files, the name of the font appears three times; in the header, in the line titled /FullName, and in the line titled /FontName. To add the word "Outline" to the font name in these locations requires 22 bytes. To add "Outline" to the font family name requires another 8 bytes. A new line of instruction needs to added to the file as well. This instruction is /StrokeWidth 1000 36 div def and requires another 29 bytes including a carriage return at the end. All told, 59 bytes must be added to the .PFB file. In some font files, there is additional instructions to apparently look for an existing copy of the font outline in the font dictionary and skip the downloading if an existing copy is already in printer memory. This may require adding "Outline" or " Outline" to the font name in one or two more instances, requiring 7 or 8 additional bytes, depending on whether a leading space is required. To create a 59 byte file, at the DOS prompt simply type: COPY CON ADD2PFB.59 then type: 12345678901234567890123456789012345678901234567890123456789 DOS should respond with "1 file(s) copied." To verify that the file was created properly and is 59 bytes in size, type: DIR ADD2PFB.59 Now merge the two files together using the DOS COPY command. For example, to add the dummy file to the renamed Helvetica-Bold file, type at the DOS prompt: COPY /B ADD2PFB.59+HVBZ____.P HVBZ____.PFB EDITING PROCEDURE ----------------- Now the tricky part begins. Using a Hex editor such as Norton Utilities' DiskEdit, several things must be accomplished in the next steps: Cut and Paste the existing file data, adding "Outline" to the font name and family name locations. Change the line containing "/PaintType 0 def" to "/PaintType 2 def." Add the line "/StrokeWidth 1000 36 div def" directly below the /PaintType line. Change the /UniqueID number so that the outline font file does not conflict with the original. Change the data offset location in the header to reflect that the file grew in size by 59 bytes. Start the Hex editor and open the new outline font .PFB file. The top of the file should look something like this if you use DiskEdit: 31 32 33 34 35 36 37 38 - 39 30 31 32 33 34 35 36 1234567890123456 37 38 39 30 31 32 33 34 - 35 36 37 38 39 30 31 32 7890123456789012 33 34 35 36 37 38 39 30 - 31 32 33 34 35 36 37 38 3456789012345678 39 30 31 32 33 34 35 36 - 37 38 39 80 01 8B 07 00 90123456789..... 00 25 21 50 53 2D 41 64 - 6F 62 65 46 6F 6E 74 2D .%!PS-AdobeFont- 31 2E 30 3A 20 48 65 6C - 76 65 74 69 63 61 2D 42 1.0: Helvetica-B 6F 6C 64 20 30 30 31 2E - 30 30 37 0D 25 25 43 72 old 001.007.%%Cr Start by outlining the section in the left (text) side starting with the C-cedilla (the 80 in hex) and ending at the last character of the first instance of the font name. Copy this to the clipboard (Ctrl-C in DiskEdit) then position the cursor at the first byte in the file and paste the section (Ctrl-V in DiskEdit.) Then add "Outline" immediately after the font name, with no space. For our example, Helvetica-Bold would change to Helvetica-BoldOutline. You might want to be careful with font names that are already long, there are some rules about the length of the font name being limited to 24 characters or something along that line. Now outline the section in the left (text) side starting with the space before the font version number (001.007 in this example) and ending with the last character of the second instance of the font name, which should be in the line /FullName (Helvetica Bold) readonly def. Copy this to the clipboard then position the cursor at the character immediately following the "e" of "Outline" that we just added to the first instance of the font name and paste the highlighted section. Note that in the "/FullName" and "/FamilyName" instances, space characters are allowed, since the text is enclosed in parentheses. Thus we would change the family name "(Helvetica)" to "(Helvetica Outline)" and the full name "(Helvetica Bold)" to (Helvetica Bold Outline)." Continue the cut-and-paste process, adding "Outline" to the "/FontName..." line and pasting the section from the end of the font name to the end of the line "/PaintType 0 def " including the carriage return character (the 0D in hex.) Change the 0 in the line to a 2, to read "/PaintType 2 def". This command tells the printer not to fill the character outlines of the font. Now, immediately following the carriage return character at the end of the "/PaintType..." line, add "/StrokeWidth 1000 36 div" (exactly as shown without the quotes.) If all worked right, immediately following the "div" should be a space and the word "def" left over from the original "/PaintType..." line. The strokewidth statement tells the printer to widen the imaginary line drawn around the character outlines. The default width is 0, which is fine since the outline is filled solid anyway. The width is expressed in character coordinates (1000 units,) in this case divided by 36, to yield a line width of 1 point for a character scaled to 36 points. While this produces a reasonably good thickness for some fonts, it may obscure the detail in more intricate outlines. Increasing the divisor (36 in this case) produces a thinner line. Next locate the "/UniqueID..." line and change the font ID number so that it won't conflict with other fonts. There are no hard-and-fast rules with the font ID numbers. However, since ID numbers have been used starting with 1 first, a higher number is less likely to be used by any other font. Use a whole new range of numbers such as 880000xx or something. The last step is to determine the offset where the binary outline data begins. This data is found immediately following the line "currentfile eexec". The offset is listed as a 16 bit word in the file header area (its the second word, or the third and fourth byte in reverse order, of the file.) In our example, the second word is 078B, appearing as "8B 07" in the display. This offset is not actually from the first byte of the file, but from the sixth -- the percent sign in "%!PS-AdobeFont-1.0:". Since the file grew by 59 bytes (or more, if you needed more) the offset has now increased by 59 or 3B hex. 078B plus 3B equals 07C6, so the third byte in the file would change from "8B" to "C6". The easiest way to compensate for the six byte difference, rather than calculate the addition in hex, is to highlight the first "e" of "eexec" in the line "currentfile eexec" just before the binary data. This is six bytes before the first binary data byte. Now look at the offset of this byte in the hex editor. In DiskEdit, the hex and decimal offsets are shown in the lower left corner of the display. Note the hex offset (NOT the decimal offset!) and move to the top of the file. Generally the offset won't increase enough to change the most significant byte (the fourth byte,) so usually only the third byte needs to be changed. Now save and close the font .PFB file and you're all done! FONT METRIC FILES ----------------- Copy the font metrics files (.AFM, .INF, and .PFM) to the subdirectory, and edit them to be consistent with the .PFB outline file. The .AFM and .INF files are regular ASCII text files and can be edited with any ASCII editor. The .PFM file used by ATM in Windows is near impossible to edit successfully, however. This is a binary file which contains a checksum byte for error checking. Any change to the file makes the checksum invalid, and ATM as well as VPWin are likely to reject it (VPWin usually crashes an Unrecoverable Application Error.) This can be overcome by a nifty shareware program called PFMFIX (or WPFFIX for Windows,) available on CIS in the ADOBE or DTPFORUM forums. PFMFIX allows changing all of the font attributes in the file and saves it in a valid format. As an alternative, edit the .AFM and .INF files with a text editor, and delete the .PFM file (not the original font's .PFM -- the one you copied into the subdirectory!) Then run ATM in Windows and add your new font. ATM will create a .PFM file from the information in the .AFM and .INF files while it adds the font. LICENSE FOR USE --------------- This material is Copyright (c) 1992 - E A BEHL. Permission is hereby granted to offer this procedure, as is, on any computer bulletin board or electronic messaging system; provided that: 1. this file is not altered in any way; 2. without exception, no charge or fee of any kind is levied for this information, including media or distribution costs. Publishers that wish to use this material are hereby granted permission to reprint this material, provided that: 1. the publisher notifies the author prior to publication; 2. the material is not edited without the approval of the author; 3. a complimentary copy of the publication in which it appears is provided to the author at the address below; 4. the byline appearing below appears, unedited, with the material. CREDITS ------- E A BEHL produces technical publications for manufacturers of electronic communications, and personal computer hardware and software products. Edward Behl has been involved in telecommunications engineering for thirteen years, and has been writing professionally for four years, the last two as a free-lance writer and consultant in desktop publishing. Feel free to contact him at: Edward A. Behl E A BEHL 2663 Red Oak Court Clearwater, FL USA 34621-2319 Tel: (813) 789-3550 Fax: (813) 787-9414 CIS: 70413,1073