Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!uw-beaver!tektronix!cae780!hplabs!sdcrdcf!burdvax!bpa!cbmvax!vu-vlsi!hvrunix!swatsun!greenber From: greenber@swatsun.UUCP Newsgroups: net.sources Subject: GETAFM - print in PostScript fonts you never knew you had. Message-ID: <1041@byzantium.UUCP> Date: Sun, 12-Apr-87 23:39:04 EST Article-I.D.: byzantiu.1041 Posted: Sun Apr 12 23:39:04 1987 Date-Received: Wed, 15-Apr-87 04:31:45 EST Organization: Swarthmore College, Swarthmore PA Lines: 326 Keywords: PostScript, Adobe Font Metics file, fonts Dear PostScriptFolk, The situation may arise where your PostScript device knows about fonts that your host computer is not familiar with. The popular TranScript package from Adobe, for example, contains two important programs, namely enscript(1) and pscat(1) (the guts of ptroff(1)), that demand font metrics information in the Adobe Font Metric (AFM) format. (In the case of pscat, the program pscatmap(8) must be run on the AFM files to produce troff width files before use.) Adobe, however, only supplies AFM files for fonts known to the old Apple LaserWriter. Many sites now use the LaserWriter Plus, which has more fonts which are not supported with AFM files. This program gets the AFM files from the LaserWriter Plus or any other PostScript device, thereby enabling enscript, pscat, ptroff, or any other programs demanding access to AFM files to print in any font supported by the PostScript device. Peter "PostScript" Greenberg Swarthmore College Swarthmore, PA 19081 (215) 328-8384 or 8610 UUCP: ...{seismo!bpa | sun!liberty}!swatsun!greenber -------------------------SNIP SNIP SNIP------------------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # getafm # getafm.man # This archive created: Mon Apr 13 00:26:15 1987 export PATH; PATH=/bin:$PATH if test -f 'getafm' then echo shar: will not over-write existing file "'getafm'" else cat << \SHAR_EOF > 'getafm' #!/bin/sh # Getafm by Peter Greenberg at Swarthmore College. February 13, 1987. # This program gets Adobe Font Metric (AFM) files from a PostScript device. # Enables enscript and other programs to know about every font on your # PostScript device. See afm(7) and other Adobe docs for more info. # # copyright 1987 by Peter Greenberg. May be used and copied without charge so # long as credit is given to the author and this message is retained. # PostScript and LaserWriter are trademarks of Adobe Systems Inc. and Apple # Computer, Inc. respectively. # # SEE THE MANUAL PAGE FOR GETAFM FOR FULL INSTRUCTIONS ON HOW TO # USE THIS PROGRAM. # # bugs? questions? contact # Peter Greenberg, Swarthmore College, Swarthmore, PA 19081 # Tel. (215) 328-8384 # UUCP: ...!seismo!bpa!swatsun!greenber # # HOW TO WORK THIS THING # # This file is a hybrid between a PostScript and a Bourne shell program. # It takes an arbitrary number of command line arguments giving names of # PostScript fonts. It spools a PostScript program that extracts font metric # information from the PostScript fonts. The PostScript program sends this # information in the format of a standard Adobe Font Metric file to its idea # of standard output, which is definitely NOT its raster device. On the Apple # LaserWriter, standard output is the same serial line on which it gets data # from the host. This program was developed on a net of Sun3's, one of which # is hooked up to an Apple LaserWriter Plus. We ran this program with lpr set # as the spooler and extracted the resultant afm files from the log file kept # by the lpd program. This file contains all messages sent back from the # printer over the tty, so the afm file may be buried amongst other stuff. # They are easy to find, however, since they are between distinctive GETAFM # banner lines. Extract these files, getting rid of the ctrl-M characters. Our # log file is /usr/spool/laser/laser-log. Install these extracted files (without # banner lines) in the directory /usr/local/lib/lw, or wherever your software # looks for afm files. Naming is important; call them [fullfontname].afm. # NOTE: The Bourne shell part of this program does little other than spool the # PostScript program, so it won't know if any of the fonts you give it are # not recognized by your PostScript device. The PostScript program will indicate # the error by writing an appropriate message instead of the table to its # standard output. # CHANGE THIS LINE IF YOUR SPOOLER IS OTHER THAN LPR. spooler=/usr/ucb/lpr #CHANGE THIS LINE IF YOUR PRINTER IS OTHER THAN POSTSCRIPT. spoolopts=-PPostScript emit_header () { echo '%!' echo "/Font /$1 def" } emit_rest () { cat < 'getafm.man' .TH GETAFM 8 "12 April 1987" .SH NAME getafm \- have your PostScript device send you an Adobe Font Metrics file for PostScript fonts. .SH SYNOPSIS .B getafm .I fontname [...] .SH RATIONALE The situation may arise where your PostScript device knows about fonts that your host computer is not familiar with. The popular TranScript package from Adobe, for example, contains two important programs, namely \fIenscript(1)\fR and \fIpscat(1)\fR (the guts of \fIptroff(1)\fR), that demand font metrics information in the Adobe Font Metric (AFM) format. (In the case of \fIpscat,\fR the program \fIpscatmap(8)\fR must be run on the AFM files to produce troff width files before use.) Adobe, however, only supplies AFM files for fonts known to the old Apple LaserWriter. Many sites now use the LaserWriter Plus, which has more fonts which are not supported with AFM files. This program gets the AFM files from the LaserWriter Plus or any other PostScript device, thereby enabling \fIenscript, pscat, ptroff,\fR or any other programs demanding access to AFM files to print in any font supported by the PostScript device. .SH DESCRIPTION Each \fIfontname\fR is the full PostScript name of a font for which font metrics information is desired. \fIgetafm\fR spools a program written in PostScript to a PostScript device. This PostScript code has the device write a file in Adobe Font Metric (AFM) format (see \fIafm(7)\fR) for each \fIfontname\fR indicated on the command line to its idea of standard output, which is certainly NOT the PostScript virtual page, and is almost definitely the communications line connecting the device to the host. This information may be read directly off the line, but on most systems data comming back from a PostScript device is stored in a log file for that device. If you have a UNIX-type system running TranScript, this will probably be /usr/spool/laser/laser-log. The AFM output will come sandwiched between appropriate banner lines. The AFM files for each \fIfontname\fR will be sent sepreately. .LP The system administrator should clip these files out (dropping the banner lines) and install them where software needing them will see them. TranScript programs on UNIX-type systems will look in the directory given by environment variable PSLIBDIR, or /usr/local/lib/lw by default. An AFM file for a given font should be named \fIfontname\fR.afm. CAUTION: The control-M characters should be removed from AFM files before use. .LP \fIgetafm\fR is a Bourne shell script which currently makes use of \fIlpr(1)\fR to spool the PostScript code, but can be modified easily to use any spooler. .SH DIAGNOSTICS Exits with non-zero return code if no fonts are specified on the command line. Since \fIgetafm\fR makes no assumptions about the PostScript device it is working with, all other error checking is done in PostScript. If PostScript cannot find the font requested it prints an appropriate message in between the banner lines in lieu of an AFM file. .SH FILES .TP 2.2i /usr/local/lib/lw/*.afm font metrics files. .TP /usr/spool/laser/laser-log probable location of log file where \fIgetafm\fR output will be found. .SH "SEE ALSO" enscript(1), pscat(1), ptroff(1), troff(1), afm(7), pscatmap(8). .br 4.2bsd: lpr(1). .br System V: lp(1). .SH CAVEATS \fIgetafm\fR output has been used by \fIenscript\fR and \fIpscat\fR (through the prior application of \fIpscatmap\fR) to produce excellent looking documents in all the fonts supplied with the Apple LaserWriter Plus. There are differences, however, between AFM files produced by \fIgetafm\fR for the original LaserWriter fonts and the AFM files supplied by Adobe. These differences are confined to character bounding box information, on which point there is never agreement between the two files, although the numbers are always in the same ballpark. The PostScript code spooled by \fIgetafm\fR uses empirical methods to determine this information, and it does so using a technique described in Adobe PostScript documentation. Nevertheless, it seems that \fIenscript\fR and \fIpscat\fR are interested only in character width information, about with there is never a discrepancy, so \fIgetafm\fR is guaranteed to work beautifully with these programs. If other problems are detected, they should be brought to the attention of the author. .SH AUTHORS .nf Peter Greenberg Swarthmore College Swarthmore, PA 19081 (215) 328-8384 or 8610 UUCP: ...{seismo!bpa | sun!liberty}!swatsun!greenber .fi .RE .SH NOTICES PostScript and TranScript are trademarks of Adobe Systems Inc. UNIX and System V are a trademarks of AT&T-Bell Labs. LaserWriter is a trademark of Apple Computer Inc. .LP Special thanks to Scott Schwartz for helping with the Bourne shell side of \fIgetafm.\fR SHAR_EOF fi # end of overwriting check # End of shell archive exit 0