2 # Generate a neatroff output device
4 # ghostscript fonts directory; should be in GS_FONTPATH
6 # output device directory
7 TP
="/path/to/font/devutf"
10 # pattern of ligatures to ignore
11 LIGIGN
="\(ct\|st\|sp\|Rp\)"
13 test -n "$1" && FP
="$1"
14 test -n "$2" && TP
="$2"
18 echo "fonts 10 R I B BI CW H HI HB S1 S" >$TP/DESC
19 echo "res $RES" >>$TP/DESC
20 echo "hor 1" >>$TP/DESC
21 echo "ver 1" >>$TP/DESC
22 echo "unitwidth 10" >>$TP/DESC
24 # afmconv troff_name font_path extra_mktrfn_options
28 cat $2 | .
/mkfn
-a -b -r$RES -t "$1" $3 $4 $5 $6 $7 | \
29 sed "/^ligatures /s/ $LIGIGN//g" >$TP/$1
32 # ttfconv troff_name font_path extra_mktrfn_options
36 cat $2 | .
/mkfn
-b -l -o -r$RES -t $1 $3 $4 $5 $6 $7 | \
37 sed "/^ligatures /s/ $LIGIGN//g" >$TP/$1
40 # otfconv troff_name font_path extra_mktrfn_options
43 TTF
="/tmp/.neatmkfn.ttf"
44 # convert the OTF file to TTF using fontforge
45 echo -e "Open(\"$2\")\nGenerate(\"$TTF\")" | fontforge
>/dev
/null
2>&1
46 ttfconv
$1 $TTF $3 $4 $5 $6 $7
51 afmconv R
$FP/n021003l.afm
-pTimes-Roman
52 afmconv I
$FP/n021023l.afm
-pTimes-Italic
53 afmconv B
$FP/n021004l.afm
-pTimes-Bold
54 afmconv BI
$FP/n021024l.afm
-pTimes-BoldItalic
55 afmconv S
$FP/s050000l.afm
-pSymbol -s
56 afmconv S1
$FP/n021003l.afm
-pTimes-Roman -s
57 afmconv AR
$FP/a010013l.afm
-pAvantGarde-Book
58 afmconv AI
$FP/a010033l.afm
-pAvantGarde-BookOblique
59 afmconv AB
$FP/a010015l.afm
-pAvantGarde-Demi
60 afmconv AX
$FP/a010035l.afm
-pAvantGarde-DemiOblique
61 afmconv H
$FP/n019003l.afm
-pHelvetica
62 afmconv HI
$FP/n019023l.afm
-pHelvetica-Oblique
63 afmconv HB
$FP/n019004l.afm
-pHelvetica-Bold
64 afmconv HX
$FP/n019024l.afm
-pHelvetica-BoldOblique
65 afmconv Hr
$FP/n019043l.afm
-pHelvetica-Narrow
66 afmconv Hi
$FP/n019063l.afm
-pHelvetica-Narrow-Oblique
67 afmconv Hb
$FP/n019044l.afm
-pHelvetica-Narrow-Bold
68 afmconv Hx
$FP/n019064l.afm
-pHelvetica-Narrow-BoldOblique
69 afmconv KR
$FP/b018012l.afm
-pBookman-Light
70 afmconv KI
$FP/b018032l.afm
-pBookman-LightItalic
71 afmconv KB
$FP/b018015l.afm
-pBookman-Demi
72 afmconv KX
$FP/b018035l.afm
-pBookman-DemiItalic
73 afmconv NR
$FP/c059013l.afm
-pNewCenturySchlbk-Roman
74 afmconv NI
$FP/c059033l.afm
-pNewCenturySchlbk-Italic
75 afmconv NB
$FP/c059016l.afm
-pNewCenturySchlbk-Bold
76 afmconv NX
$FP/c059036l.afm
-pNewCenturySchlbk-BoldItalic
77 afmconv PA
$FP/p052003l.afm
-pPalatino-Roman
78 afmconv PR
$FP/p052003l.afm
-pPalatino-Roman
79 afmconv PI
$FP/p052023l.afm
-pPalatino-Italic
80 afmconv PB
$FP/p052004l.afm
-pPalatino-Bold
81 afmconv PX
$FP/p052024l.afm
-pPalatino-BoldItalic
82 afmconv C
$FP/n022003l.afm
-pCourier
83 afmconv CO
$FP/n022003l.afm
-pCourier
84 afmconv CW
$FP/n022003l.afm
-pCourier
85 afmconv CI
$FP/n022023l.afm
-pCourier-Oblique
86 afmconv CB
$FP/n022004l.afm
-pCourier-Bold
87 afmconv CX
$FP/n022024l.afm
-pCourier-BoldOblique
88 afmconv ZI
$FP/z003034l.afm
-pZapfChancery-MediumItalic
89 afmconv ZD
$FP/d050000l.afm
-pZapfDingbats
91 # The first argument of afmconv, ttfconv, and otfconv is the troff
92 # name of the font and their second argument is its path. Any other
93 # argument is passed to mkfn directly. The postscript names of the
94 # fonts are inferred from the fonts themselves To change that, you
95 # can specify their names via the -p argument of *conv functions.
97 find $FP/ -name '*.afm' |
while read FN
99 afmconv
`basename $FN .afm` $FN
102 find $FP/ -name '*.ttf' |
while read FN
104 ttfconv
`basename $FN .ttf` $FN
107 find $FP/ -name '*.otf' |
while read FN
109 otfconv
`basename $FN .otf` $FN