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