2 # Generate a neatroff output device
4 # ghostscript font directory; it may contain otf and ttf files also
5 FP
="/mnt/file/gs/fonts"
6 # output device directory
7 TP
="/root/queue/devutf"
10 # pattern of ligatures to ignore
11 LIGIGN
="\(ct\|st\|sp\|Rp\)"
12 # pattern of allowed opentype features
13 OTFFEATS
="\(swsh\|titl\|smcp\|case\)"
15 # otherwise sort and grep would be too slow
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 postscript_name font_filename
30 cat $FP/$3 | .
/mktrfn
$4 -a -r$RES -t $1 -p $2 >$TP/$1
33 # converting otf and ttf fonts; needs heirloom's otfdump
34 # otfconv troff_name postscript_name font_path
37 ODOUT
="/tmp/.mktrfn.otfdump"
38 FEATS
="`otfdump -s $3 | cut -f2 -d ' ' | sort | uniq`"
39 echo "$1: `echo $FEATS | tr '\n' ' '`"
40 otfdump
-nc $3 >$ODOUT
41 otfdump
-k $3 |
sort |
uniq >>$ODOUT
42 # without any substitutions
43 cat $ODOUT | .
/mktrfn
$4 -r$RES -p $2 |
sed "/^ligatures /s/ $LIGIGN//g" >$TP/$1
44 for FEAT
in `echo $FEATS | tr ' ' '\n' | sed "/$OTFFEATS/!d"`
47 (otfdump
-s $3 |
grep "^feature $FEAT" |
sort |
uniq; cat $ODOUT) | \
48 .
/mktrfn
$4 -r$RES -p $2 | \
49 sed "/^ligatures /s/ $LIGIGN//g" >$TP/$1.
$FEAT
55 afmconv R Times-Roman n021003l.afm
56 afmconv I Times-Italic n021023l.afm
57 afmconv B Times-Bold n021004l.afm
58 afmconv BI Times-BoldItalic n021024l.afm
59 afmconv S Symbol s050000l.afm
-s
60 afmconv S1 Times-Roman n021003l.afm
-s
61 afmconv AR AvantGarde-Book a010013l.afm
62 afmconv AI AvantGarde-BookOblique a010033l.afm
63 afmconv AB AvantGarde-Demi a010015l.afm
64 afmconv AX AvantGarde-DemiOblique a010035l.afm
65 afmconv H Helvetica n019043l.afm
66 afmconv HI Helvetica-Oblique n019063l.afm
67 afmconv HB Helvetica-Bold n019044l.afm
68 afmconv HX Helvetica-BoldOblique n019064l.afm
69 afmconv Hr Helvetica-Narrow n019043l.afm
70 afmconv Hi Helvetica-Narrow-Oblique n019063l.afm
71 afmconv Hb Helvetica-Narrow-Bold n019044l.afm
72 afmconv Hx Helvetica-Narrow-BoldOblique n019064l.afm
73 afmconv KR Bookman-Light b018012l.afm
74 afmconv KI Bookman-LightItalic b018032l.afm
75 afmconv KB Bookman-Demi b018015l.afm
76 afmconv KX Bookman-DemiItalic b018035l.afm
77 afmconv NR NewCenturySchlbk-Roman c059013l.afm
78 afmconv NI NewCenturySchlbk-Italic c059033l.afm
79 afmconv NB NewCenturySchlbk-Bold c059016l.afm
80 afmconv NX NewCenturySchlbk-BoldItalic c059036l.afm
81 afmconv PA Palatino-Roman p052003l.afm
82 afmconv PR Palatino-Roman p052003l.afm
83 afmconv PI Palatino-Italic p052023l.afm
84 afmconv PB Palatino-Bold p052004l.afm
85 afmconv PX Palatino-BoldItalic p052024l.afm
86 afmconv C Courier n022003l.afm
87 afmconv CO Courier n022003l.afm
88 afmconv CW Courier n022003l.afm
89 afmconv CI Courier-Oblique n022023l.afm
90 afmconv CB Courier-Bold n022004l.afm
91 afmconv CX Courier-BoldOblique n022024l.afm
92 afmconv ZI ZapfChancery-MediumItalic z003034l.afm
93 afmconv ZD ZapfDingbats d050000l.afm
95 # For otf and ttf files, we assume the postscript name of the font
96 # can be obtained by dropping its extension. Otherwise, remove the
97 # -p argument of mktrfn in otfconv function.
101 otfconv
"`basename $f .otf`" "`basename $f .otf`" "$f" -k50
106 otfconv
"`basename $f .ttf`" "`basename $f .ttf`" "$f" -k50