blob: b7fb42f185363425dbcbbc806ae810fca70d8a58 (
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
|
#!/usr/local/bin/bash
#
# This script file makes a new X/TeX screen font, because one wasn't
# found. Parameters are:
#
# name dpi bdpi magnification destdir
#
# `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. 'destdir' is the directory in which to cache the new
# font.
#
# Note that this file must execute Metafont, mftobdf, and then bdftosnf,
# and place the result in the correct location for X
# to find it subsequently.
#
# Of course, it needs to be set up for your site.
#
# TEMPDIR needs to be unique for each process because of the possibility
# of simultaneous processes running this script.
TEMPDIR=/tmp/bdf-snf.$$
NAME=$1
DPI=$2
BDPI=$3
MAG=$4
MODE=$5
DESTDIR=$6
umask 0
#declare -i cmfound=0
#MFDIRS=`echo $MFINPUTS | gawk -F: '{ for (i=1; i<=NF; i++) print $i }'`
#for f in $MFDIRS
#do
# if [ -r $f/$NAME.mf ]; then
# declare -i cmfound=1
# fi
#done
if [ -r /usr/local/lib/tex/fonts/ps-outlines/$NAME.pfa ]
then
echo Building X-font from PostScript outline
PStoXfont $1 $2 $3 $4 $5 $6
exit 0
else
echo Building X-font from MetaFont outline
fi
# Something like the following is useful at some sites.
GFNAME=$NAME.$DPI'gf'
BDFNAME=$NAME.$DPI.'bdf'
SNFNAME=$NAME.$DPI.pcf
COMPRESS=1
# check if we're not running with MIT server after all
if xdpyinfo|grep -s 'vendor string: *.*MIT.*'; then
# DESTDIR=/usr/lib/X11/fonts/xtex
# SNFNAME=$NAME.$DPI.'snf'
COMPRESS=0
MITSERVER=1
fi
if test "$COMPRESS" = "1"
then
SNFZNAME=${SNFNAME}'.Z'
else
SNFZNAME=${SNFNAME}
fi
# Clean up on normal or abnormal exit
trap "cd /; rm -rf $TEMPDIR $DESTDIR/bdftmp.$$ $DESTDIR/snftmp.$$" 0 1 2 15
mkdir $TEMPDIR
cd $TEMPDIR
if test -r $DESTDIR/$BDFNAME
then
echo "$DESTDIR/$BDFNAME already exists!"
exit 0
fi
if test -r $DESTDIR/$SNFNAME
then
echo "$DESTDIR/$SNFNAME already exists!"
exit 0
fi
if test -r $DESTDIR/$SNFZNAME
then
echo "$DESTDIR/$SNZFNAME already exists!"
exit 0
fi
##
# First try mftobdf, maybe it exists...
##
echo "1st mftobdf -dpi" $DPI $NAME
mftobdf -dpi $DPI $NAME
if test ! -r $BDFNAME
then
pwd
echo mf "\mode:=$MODE; mag:=$MAG/1000; scrollmode; input $NAME </dev/null"
mf "\mode:=$MODE; mag:=$MAG/1000; scrollmode; input $NAME" </dev/null
if test ! -r $GFNAME
then
#
# My local metafont gives bogus names occasionally. Don't know why.
#
echo "Unable to find $GFNAME in directory "`pwd`
OLDDPI=$DPI
NEWDPI=`expr $DPI - 1`
if [ -r $NAME.$NEWDPI'gf' ] ; then
DPI=$NEWDPI
fi
NEWDPI=`expr $DPI + 1`
if [ -r $NAME.$NEWDPI'gf' ] ; then
DPI=$NEWDPI
fi
if [ -r $NAME.$DPI'gf' ] ; then
GFNAME=$NAME.$DPI'gf'
BDFNAME=$NAME.$DPI.'bdf'
SNFNAME=$NAME.$DPI.pcf
echo "Metafont built $GFNAME instead of $NAME.${OLDDPI}gf, \
but that's ok..."
gftopk $GFNAME
else
echo "Metafont failed for some reason on $GFNAME, \
but continuing anyway"
fi
else
gftopk $GFNAME
fi
echo "mftobdf -dpi" $DPI $NAME
mftobdf -dpi $DPI $NAME
if test ! -r $BDFNAME
then
echo "Mftobdf failed for some reason on $BDFNAME"
exit 1
fi
fi
echo "$FONTCOMPILER"
if [ $MITSERVER ]; then
bdftopcf $BDFNAME > $SNFNAME
else
/usr/bin/dxfc $BDFNAME > $SNFNAME
fi
if test ! -r $SNFNAME
then
echo "Font compiler failed for some reason on $SNFNAME"
exit 1
fi
# Install the BDF and SNF files carefully, since others may be doing
# the same as us simultaneously.
#cp $BDFNAME $DESTDIR/bdftmp.$$
cp $SNFNAME $DESTDIR/snftmp.$$
cd $DESTDIR
#mv bdftmp.$$ $BDFNAME
mv snftmp.$$ $SNFNAME
if test "$COMPRESS" = "1"
then
compress -f $SNFNAME
fi
if [ $MITSERVER ]; then
mkfontdir $DESTDIR
else
/usr/bin/dxmkfontdir $DESTDIR
fi
xset +fp $DESTDIR
xset fp rehash
exit 0
|