blob: d11a32a23a5e8282ea59a1736dfa277362270070 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
#!/bin/sh
#
# This script file makes a new TeX PK font, because one wasn't
# found. Parameters are:
#
# name dpi bdpi magnification [[mode] subdir]
#
# `name' is the name of the font, such as `cmr10'. `dpi' is
# the resolution the font is needed at. `bdpi' is the base
# resolution, useful for figuring out the mode to make the font
# in. `magnification' is a string to pass to MF as the
# magnification. `mode', if supplied, is the mode to use.
#
# Note that this file must execute MetaFont, and then gftopk,
# and place the result in the correct location for the PostScript
# driver to find it subsequently. If this doesn't work, it will
# be evident because MF will be invoked over and over again.
#
# If no METAFONT source is available for `name' MakeTeXPK tries to
# find a type1 font and if such a font is found ps2pk will be used
# to render it.
# If the fontname is available in $TEXCONFIG/psfonts.map it will use
# the real PostScript name found for `name' otherwise it will use
# `name' straight away.
#
# Font sources can be put into a single directory or in different
# subdirectories from $MFFACES and $T1FACES.
#
# Of course, it needs to be set up for your site.
#
# Base directories where we have installed TeX and its programs
TEXDIR=/usr/local/lib/tex
TEXBINDIR=$TEX/bin
# we explicity set the PATH
PATH=/bin:/usr/bin:$TEXBINDIR:/usr/ucb; export PATH
# Provide a usage message to refresh human memories.
if test \( $# -lt 4 \) -o \( $# -gt 6 \)
then
echo "Usage: `basename $0` fontname dpi bdpi magnification [[mode] subdir]"
exit 1
fi
# Where MakeTeXPK will install its fonts (everybody seems to choose
# something different)
DESTDIR=$TEXDIR/extra-fonts
# Where we look for METAFONT sources
MFSUBDIR=typefaces
MFFACES=/usr/local/lib/mf/$MFSUBDIR
# Where we look for Type1 fonts and AFM files (do you know a better place?)
T1SUBDIR=type1faces
T1FACES=/usr/local/lib/mf/$T1SUBDIR
# Where we look for dvips stuff
TEXCONFIG=$TEXDIR/ps
# What encoding scheme do we use for Type1 text fonts?
# DEF_TEXT_ENCODING="" (default: AdobeStandardEncoding)
# DEF_TEXT_ENCODING="-eEC.enc" (Extended Computer Modern!)
DEF_TEXT_ENCODING=""
#
# TEMPDIR needs to be unique for each process because of the possibility
# of simultaneous processes running this script.
#
if test "$TMPDIR" = ""
then
TEMPDIR=/tmp/mtpk.$$
else
TEMPDIR=$TMPDIR/mtpk.$$
fi
NAME=$1
DPI=$2
BDPI=$3
MAG=$4
if test $# -ge 5 ;then MODE=$5 ;fi
if test $# -ge 6 ;then SUBDIR=$6 ;fi
umask 0
if test "$MODE" = ""
then
if test $BDPI = 300
then
MODE=imagen
elif test $BDPI = 400
then
MODE=nexthi
elif test $BDPI = 100
then
MODE=nextscreen
elif test $BDPI = 635
then
MODE=linolo
elif test $BDPI = 1270
then
MODE=linohi
elif test $BDPI = 2540
then
MODE=linosuper
else
echo "I don't know the mode for $BDPI"
echo "Have your system admin update MakeTeXPK"
exit 1
fi
fi
# Something like the following is useful at some sites.
# DESTDIR=/usr/local/lib/tex/fonts/pk.$MODE
PKNAME=$NAME.$DPI'pk'
# Clean up on normal or abnormal exit
trap "cd /; rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15
if test ! -d $DESTDIR
then
mkdir $DESTDIR
fi
if test "$SUBDIR" != ""
then
DESTDIR=$DESTDIR"$SUBDIR"
if test ! -d $DESTDIR
then
mkdir $DESTDIR
fi
fi
mkdir $TEMPDIR
cd $TEMPDIR
if test -r $DESTDIR/$PKNAME
then
echo "$DESTDIR/$PKNAME already exists!"
exit 0
fi
# check also in the standard place
if test "$SUBDIR" = ""
then
if test -r $TEXDIR/fonts/pk/$PKNAME
then
echo $TEXDIR/fonts/pk/$PKNAME already exists!
exit 0
fi
else
if test -r $TEXDIR/fonts/pk/$SUBDIR"$PKNAME"
then
echo $TEXDIR/fonts/pk/$SUBDIR"$PKNAME" already exists!
exit 0
fi
fi
# Do we have a METAFONT source for this typeface?
for TF in `find $MFFACES -type f -name "*$NAME.mf" -print`
do FACE=`expr $TF : "$MFFACES/\(.*\)/$NAME.mf"`
break
done
if test -n "$FACE"
then
# Found a METAFONT source for $NAME
if test "$FACE" = typefaces
then MFINPUTS=.:$MFFACES
else MFINPUTS=.:$MFFACES/$FACE
fi
export MFINPUTS
echo mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" \\\</dev/null
mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" </dev/null
GFNAME=$NAME.$DPI'gf'
if test ! -r $GFNAME
then
echo "Metafont failed for some reason on $GFNAME"
exit 1
fi
gftopk ./$GFNAME ./$PKNAME
# Install the PK file carefully, since others may be doing the same
# as us simultaneously.
mv $PKNAME $DESTDIR/pktmp.$$
cd $DESTDIR
mv pktmp.$$ $PKNAME
exit 0
fi
# Find the full PostScript name for this virtual font in
# $TEXCONFIG/psfonts.map or use NAME as its real name
if test ! -f $TEXCONFIG/psfonts.map
then
echo "You should install file psfonts.map in $TEXCONFIG!"
exit 0
fi
LINE=`grep "^%*$NAME[ \t]" $TEXCONFIG/psfonts.map`
if test -z "$LINE"
then # take the NAME as default name
FULLNAME=$NAME
else
FULLNAME=`expr "$LINE" : "^%*$NAME[ ]*\([^ ]*\)"`
if test -z "$FULLNAME"
then
echo "Can't figure out real PostScript name for $NAME!"
exit 0
fi
SLANT=""
SLANTFONT=`expr "$LINE" : '^.*"\([^ ]*\) SlantFont"'`
if test ! -z "$SLANTFONT"
then
SLANT="-S$SLANTFONT"
fi
EXTEND=""
EXTENDFONT=`expr "$LINE" : '^.*"\([^ ]*\) ExtendFont"'`
if test ! -z "$EXTENDFONT"
then
EXTEND="-E$EXTENDFONT"
fi
fi
# Try to find the directory containing the PostScript font and the
# basename of the type1 font so we can find the AFM-file later
for TF in `find $T1FACES -type f -name "*$FULLNAME*" -print`
do FACE=`expr $TF : "$T1FACES/\(.*\)/$FULLNAME*"`
EXT=`expr $TF : '.*\([.].*\)$'`
if test "$EXT" = ""
then FNAME=`basename $TF`
else FNAME=`basename $TF "$EXT"`
fi
break
done
if test -n "$FACE"
then
# Found a Type1 source for $NAME
if test "$FACE" = type1faces
then
T1INPUTS=.:$T1FACES
AFM=$T1FACES/$FNAME.afm
TYPE1=$T1FACES/$FACE/$FNAME
else
T1INPUTS=.:$T1FACES/$FACE
AFM=$T1FACES/$FACE/$FNAME.afm
TYPE1=$T1FACES/$FACE/$FNAME
fi
export T1INPUTS
# Do we have a PFB/PFA file?
if test ! -f "$TYPE1"
then
if test -f "$TYPE1.pfb"
then
FULLNAME=$FULLNAME.pfb
elif test -f "$TYPE1.pfa"
then
FULLNAME=$FULLNAME.pfa
else
echo Strange: I do not see the $TYPE1 font . . .
exit 0
fi
fi
# Do we have the AFM file?
if test ! -f "$AFM"
then
echo no AFM file available for $FULLNAME
exit 0
fi
# If we don't use default AFM encoding then we have to check
# if we can apply this encoding (text fonts only)
if test "$DEF_TEXT_ENCODING" != ""
then
# What is encoding scheme that the AFM file uses?
ENC=`grep '^EncodingScheme' $AFM`
if test -z "$ENC"
then
echo $AFM: Invalid AFM file!
exit 0
fi
EXT_ENC=`expr "$ENC" : '^EncodingScheme[ ]*\(.*\)$'`
case $EXT_ENC in
AdobeS*) ENCODING=$DEF_TEXT_ENC;;
ISO*) ENCODING=$DEF_TEXT_ENC;;
*) ENCODING="";;
esac
fi
# Now we are ready to render the type1 font
echo "ps2pk -v $ENCODING -X$DPI $SLANT $EXTEND $FULLNAME $PKNAME"
ps2pk -v $ENCODING -X$DPI $SLANT $EXTEND $FULLNAME $PKNAME
mv $PKNAME $DESTDIR/pktmp.$$
cd $DESTDIR
mv pktmp.$$ $PKNAME
exit 0
fi
echo No font source found for $NAME
exit 0
|