home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
s
/
stex2-18.zip
/
SeeTeX
/
Xtex
/
TeXtoXfont.SCR
< prev
next >
Wrap
Text File
|
1991-02-20
|
3KB
|
143 lines
#!/bin/sh
#
# 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
# Something like the following is useful at some sites.
GFNAME=$NAME.$DPI'gf'
BDFNAME=$NAME.$DPI.'bdf'
SNFNAME=$NAME.$DPI.X_FONT_SUFFIX
COMPRESS=X_FONT_COMPRESS
# 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=1
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
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 $cwd"
echo "Metafont failed for some reason on $GFNAME, but continuing anyway"
# exit 1
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
bdftosnf $BDFNAME > $SNFNAME
else
X_FONT_COMPILER
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
X_FONT_MAKE_DIR $DESTDIR
fi
X_FONT_PREPEND $DESTDIR
X_FONT_RESET
exit 0