diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /info/maketexwork/ex-D-06 |
Initial commit
Diffstat (limited to 'info/maketexwork/ex-D-06')
-rw-r--r-- | info/maketexwork/ex-D-06 | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/info/maketexwork/ex-D-06 b/info/maketexwork/ex-D-06 new file mode 100644 index 0000000000..b7fb42f185 --- /dev/null +++ b/info/maketexwork/ex-D-06 @@ -0,0 +1,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 |