TrueType Font to PostScript Type 42 Conversion Using Program TrueTypeToType42.ps TrueType fonts are widely available but cannot be used directly in current versions of PostScript, levels 1 through 3, although, with Adobe's introduction of Open Type fonts, that may change in the future. To overcome this, several programs have been written which create a PostScript Type 1 font from a TrueType font. With level 2.013 PostScript, Adobe introduced a new font category, Type 42, which is, to use Adobe's own words, a TrueType font wrapped in some PostScript code. Actually the complexity of the conversion is considerably more than the word "wrapped" implies and, although the preponderant view is that the use of Type 42 gives better printed output than conversion to Type 1, few programs for the conversion to Type 42 exist. This document describes the use of the PostScript program TrueTypeToType42.ps to generate the equivalent PostScript Type 42 font file from a TrueType font file. The actual work of "wrapping" is done by the GhostScript procedure .loadttfont and this program simply operates on the resulting file. I don't know when .loadttfont was introduced into GhostScript but I developed this program using version 6.5 and am now using it with version 7.0. Preliminaries Before you can run the program, you will probably have to make two minor changes to it to suit your system. First, the value of the key /Path is the full path name of the folder where the output files are stored. This is currently set to D:\Temp and you may wish to change it. Search for /Path and change its value. Note that this folder must exist, the program will not create it for you. Second, the setpagedevice dictionary is set for simplex printing, taking the paper from media position 3. To change these, search for setpagedevice and change the value of /Duplex to true and the value of /MediaPosition to whatever suits your printer. Running the program TrueTypeToType42.ps is run under GhostScript from the command prompt with the command line: <Full path name of GhostScript executable> -I<Full path to the GhostScript main folder> -- <Full path name of the conversion program> <Full path name of the TrueType font> NB This is a single command line, it has been folded to fit the text width. Note that the double hyphen at the start of the third line is part of the command. The program generates three files, all in a folder of your choice (see preliminaries above). The files are: The Type 42 equivalent of the TrueType font. The root name of this file is the PostScript name of the font and its extension is .pfa. For example, the name of the font defined by the TrueType file times.ttf is TimesNewRomanPSMT and the name of its Type 42 equivalent is TimesNewRomanPSMT.pfa. The length of the Type 42 file is about twice that of the TrueType original. As the .pfa extension implies, the Type 42 file can be treated as any other .pfa file. A PostScript file called ShowAllGlyphs.ps which will display under GhostView or cause a PostScript printer to print a table of all the glyphs defined by the font alongside their names. This file contains a copy of the Type 42 font file in its prologue so that it is self contained and can be displayed in GhostView or printed without downloading the font. A report on the operation of the program in file TrueTypeToType42.out. The folder into which these files are placed is defined in the setup section of the program as the value of the key /Path. This must be set to suit your system. Go to the program line %%BeginSetup. After it you will find a few lines of comments and the the line in question. Modify the contents of the string being careful to maintain the parentheses enclosing it. Note that the folder must already exist, the program will not create it for you. Since TrueTypeToType42.ps is a PostScript file, it should run on any platform, i.e. Unix, Linux, Macs, PCs, provided there is a recent version of GhostScript installed. I am not sure of the precise meaning of recent but I have run the program under GhostScript 6.5 and 7.0. The Type 42 file has the extension pfa and can be treated as a normal pfa file. For example: The font can be renamed by changing the value of the /FontName key. The font can be reencoded by changing its Encoding vector. The font file can be included in a PostScript file. The font file can be stored on a printer hard disk. Running in Windows What follows is a description of the way I run TrueTypeToType42 on my system which is a PC under Windows 2000. I hope they will provide pointers to its use in other systems. A large number of TrueType fonts came with my copy of Windows 2000. They are by default placed in folder C:\Winnt\Fonts. This folder has special properties for working with the Windows font software and I have found it more convenient to keep a copy of all TrueType fonts in folder C:\TrueTypeFonts and to convert them from there. I am currently using GhostScript 7.00. My command line is: C:\GS\GS7.00\bin\gswin32 -IC:\GS\GS7.00 -- D:\Fonts\TrueType\Utilities\TrueTypeToType42.ps C:\TrueTypeFonts\<name of the TrueType font file> To get round the great length of this command, I have created a batch file called TTF2T42WE.bat. This can be run from the Windows command prompt but I find it more convenient to run it from within Windows Explorer. To run it from the Windows command prompt, first place a copy of TTF2T42WE.bat in a folder on your path. I have it in C:\BatchFiles. Then enter TTF2T42WE followed by the full path name of the TrueType font to be converted. Pressing Enter will then start the program and create the three output files. If the current folder is the one containing the TrueType file, you can enter only the name of the TrueType file rather than its full path name. If you prefer to operate from Windows Explorer, as I do, place a copy of TTF2T42WE.bat in your SendTo folder which in my case is: C:\Documents and Settings\Thomas H. Barton\SendTo To use this batch file: Start Windows Explorer. Move to the folder containing the TrueType file. Right click on the TrueType file. This displays a list of activities. On this list, click on SendTo to display another list of activities one of which is TTF2T42WE. Left click on TTF2T42WE. This invokes the conversion program. The three output files are placed in the folder specified by the /Path key in TrueTypeToType42.ps. Thomas H. Barton, April 2002 email@example.com
Download the contents of this package in one zip archive (14.5k).
TrueTypeToType42 – Generate a Type 42 font from a TrueType font
The package provides a PostScript program, to run under ghostscript, that will read a TrueType font and produce an Adobe Type 42 (PFA) font as output.
|Thomas H. Barton