🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #741

MakeTFM -- a small theft

#741
From: Timothy Murphy
Date: Tue, 04 Aug 1992 19:30
108 lines
3188 bytes
DVIPS has a very nice facility for invoking Metafont
to make missing PK files,
using the shell script MakeTeXPK .

But of course, you have to have the corresponding TFM files already,
to create the DVI file with which to feed DVIPS.

I use the Unix shell script MakeTFM below --
which is basically MakeTeXPK with its heart taken out --
to create TFM files from the corresponding MF files.
(Sort of "priming" DVIPS.)

So if someone publishes, say, squiggle.mf on the net, I run

% MakeTFM squiggle

to create squiggle.tfm .
(Nb squiggle.mf has to be installed where MF expects to find it.)
Then I can use DVIPS to print out the instruction manual
squiggling.tex (or whatever).
Or run "tex testfont" to see what squiggle looks like.

=================== MakeTFM ===================
#!/bin/sh
#
#   This script file makes a new TeX TFM font, because one wasn't
#   found.  Usage:
#
#   MakeTFM name [mode]
#
#   `name' is the name of the font, such as `cmr10'.
#   `mode', if supplied, is the mode to use.
#
#   Note that this file must execute Metafont, and place the result 
#   in the correct location.
#
#   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.
##DESTDIR=/LocalLibrary/Fonts/TeXFonts/pk
DESTDIR=/usr/local/lib/tex/localfonts
TEMPDIR=/tmp/mttfm.$$
NAME=$1
MODE=$2

umask 0

if test "$MODE" = ""
then MODE=laserwriter
fi

TFMNAME=$NAME.$DPI'tfm'

# Clean up on normal or abnormal exit
trap "cd /; rm -rf $TEMPDIR $DESTDIR/tfmtmp.$$" 0 1 2 15

if test ! -d $DESTDIR
then
   mkdir $DESTDIR
fi

mkdir $TEMPDIR
cd $TEMPDIR

if test -r $DESTDIR/$TFMNAME
then
   echo "$DESTDIR/$TFMNAME already exists!"
   exit 0
fi

# check also in the standard place

if test -r /usr/local/lib/tex/fonts/$TFMNAME
then
   echo /usr/lib/tex/fonts/$TFMNAME already exists!
   exit 0
fi

echo mf "\mode:=$MODE; mag:=1; scrollmode; input $NAME" \\\</dev/null
mf "\mode:=$MODE; mag:=1; scrollmode; input $NAME" </dev/null
if test ! -r $TFMNAME
then
   echo "Metafont failed for some reason on $TFMNAME"
   exit 1
fi

# Install the TFM file carefully, since others may be doing the same
# as us simultaneously.

chmod 644 $TFMNAME
mv $TFMNAME $DESTDIR/pktmp.$$
cd $DESTDIR
mv pktmp.$$ $TFMNAME

exit 0
===============================================

Incidentally, I was wondering if there is any way
of stopping MF from outputting .gf files
(while still outputting .tfm files),
short of re-defining "shipit" or something like that?

-- 
Timothy Murphy  
e-mail: tim@maths.tcd.ie
tel: +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
Technical Details
Message-ID: <1992Aug4.193030.4509@maths.tcd.ie>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!ieunet!tcdcs!maths.tcd.ie!tim

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!ieunet!tcdcs!maths.tcd.ie!tim
From: tim@maths.tcd.ie (Timothy Murphy)
Subject: MakeTFM -- a small theft
Message-ID: <1992Aug4.193030.4509@maths.tcd.ie>
Summary: A script for invoking MF to make .tfm files
Keywords: TeX TFM font files
Organization: Dept. of Maths, Trinity College, Dublin, Ireland.
Date: Tue, 4 Aug 1992 19:30:30 GMT
Lines: 108