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
|
#!/bin/sh
#
# Do not run this script, or dvips, as setuid programs! This will
# result in a major security hole!
#
# This script file makes a new TeX PK font, because one wasn't
# found. Parameters are:
#
# name dpi bdpi magnification [mode [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. `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.
#
# Of course, it needs to be set up for your site.
#
DEFDESTDIR=/usr/local/lib/texmf/fonts/gen/pk
#
# 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
MODE=$5
DESTDIR=$6
#
if test "$MODE" = "default"
then
MODE=""
fi
if test "$DESTDIR" = ""
then
DESTDIR=$DEFDESTDIR
fi
#
# Prevent display under the X Window System. Except it doesn't always
# work; some sh'ells don't seem to understand unset. There are also some
# versions of METAFONT that don't work if the DISPLAY isn't set and
# the term type is set to xterm.
#
# unset DISPLAY
umask 0
if test "$MODE" = ""
then
if test $BDPI = 300
then
MODE=cx
elif test $BDPI = 600
then
MODE=imagen
MAG="2*($MAG)"
elif test $BDPI = 200
then
MODE=FAX
elif test $BDPI = 360
then
MODE=nechi
elif test $BDPI = 400
then
MODE=nexthi
elif test $BDPI = 100
then
MODE=nextscrn
elif test $BDPI = 72
then
MODE=seventwo
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 MakePK"
exit 1
fi
fi
GFNAME=$NAME.$DPI'gf'
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
chmod 777 $DESTDIR
fi
# added by gwb, to allow searching in current dir before cd'ing
if test "$MFINPUTS" != ""
then
MFINPUTS=$MFINPUTS:`pwd`; export MFINPUTS
fi
mkdir $TEMPDIR
cd $TEMPDIR
#if test -r $DESTDIR/$PKNAME
#then
# echo "$DESTDIR/$PKNAME already exists!"
# exit 0
#fi
unset DISPLAY
echo "mf \"\\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME\" </dev/null"
mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" </dev/null
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
chmod a+r $PKNAME
exit 0
|