home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh -x
- # @(#)$Header: MakeTeXPK,v 1.2 91/08/19 17:53:48 hmgr Exp $
- # @(#)Based on labrea.stanford.edu:/pub/dvips547.tar.Z dated Jan 27 02:14 size 244319
- #
- # This script file makes a new TeX PK font, because one wasn't
- # found. Parameters are:
- #
- # name dpi bdpi magnification [mode]
- #
- # `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.
- #
- # TEMPDIR needs to be unique for each process because of the possibility
- # of simultaneous processes running this script.
- TEMPDIR=/tmp/mtpk.$$
- NAME=$1
- DPI=$2
- BDPI=$3
- MAG=$4
- MODE=$5
-
- umask 0
-
- if test "$MODE" = ""
- then
- if test $BDPI = 300
- then
- MODE=laser
- elif test $BDPI = 1270
- then
- MODE=lino
- 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 with TeX from hpdtl.ctgsc.hp.com
- PATH=$PATH:/usr/lib/tex/bin
- MFINPUTS=/usr/lib/tex/cm:/usr/lib/tex/mf:/usr/lib/tex/macros
- export MFINPUTS
- MAGDIR=`dc <<!
- 4 k $DPI $BDPI / .0005 + 1000 * 0 k 1 / 3 k 1000 / p
- !
- `
- DESTDIR=/usr/lib/tex/fontbits/$MODE/$MAGDIR
- GFNAME=$NAME.$DPI'gf'
- PKNAME=$NAME.'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
-
- mkdir $TEMPDIR
- cd $TEMPDIR
-
- if test -r $DESTDIR/$PKNAME
- then
- echo "$DESTDIR/$PKNAME already exists!"
- exit 0
- fi
-
- echo cmmf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" \\\</dev/null
- cmmf "\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
-
- exit 0
-