2 % written by James Clark <jjc@jclark.uucp>
3 % print an afm file on the standard output
4 % usage is `fontname printafm' eg `/Times-Roman printafm'
6 % From the `dvitops' distribution, which included this notice:
7 % dvitops is not copyrighted; you can do with it exactly as you please.
8 % I would, however, ask that if you make improvements or modifications,
9 % you ask me before distributing them to others.
11 % Altered by d.love@dl.ac.uk to produce input for Rokicki's afm2tfm,
12 % which groks the format of the Adobe AFMs.
14 % $Id: printafm.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
15 % Modified by L. Peter Deutsch 9/14/93:
16 % uses Ghostscript's =only procedure to replace 'buf cvs print'.
17 % Modified by L. Peter Deutsch 9/6/95:
18 % uses Ghostscript's shellarguments facility to accept the font name
19 % on the command line.
25 dup dup 8#141 ge exch 8#172 le and {
33 (StartCharMetrics ) print
34 currentfont /CharStrings get dup length exch /.notdef known { 1 sub } if =
35 currentfont 1000 scalefont setfont 0 0 moveto
36 /e currentfont /Encoding get def
45 % s contains an entry for each name in the original encoding vector
50 % v is the new encoding vector
55 % fill up v with names in CharStrings
57 currentfont /CharStrings get {
66 % define a new font with v as its encoding vector
67 currentfont maxlength dict /f exch def
69 exch dup dup /FID ne exch /Encoding ne and {
77 % make this new font the current font
78 /temp f definefont setfont
79 % print a entry for each character not in old vector
80 /e currentfont /Encoding get def
83 dup dup /.notdef ne exch s exch known not and {
92 % name actual_code normal_code printmetric -
98 onechar 0 3 -1 roll put
99 onechar stringwidth pop round cvi =only
102 onechar false charpath flattenpath mark pathbbox counttomark {
111 % fontname printafm -
114 findfont gsave setfont
115 (StartFontMetrics 2.0) =
116 (FontName ) print currentfont /FontName get =
120 currentfont /FontInfo get {
122 =string cvs dup dup 0 get 0 exch toupper put print
129 currentfont /FontBBox get {
130 ( ) print round cvi =only
139 % Check for command line arguments.
143 { (Usage: printafm fontname\n) print flush }