Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/lib/texmf/bin/rc/mktexmf

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
# mktexmf -- make a new MF file, because one wasn't found.
# 
# (If you change or delete the word `original' on the previous line,
# installation won't write this script over yours.)
# 
# te@informatik.uni-hannover.de, kb@mail.tug.org, and infovore@xs4all.nl.
# translated to rc by rsc
# Public domain.

version='$Id: mktexmf,v 1.13 1998/02/20 16:26:17 olaf Exp $'
progname=`{echo $0 | sed 's%.*/%%'}
usage='Usage: $progname FONT.

Makes the Metafont source file for FONT, if possible. For example,
`ecr12'' or `cmr11''.'

if(~ $#MT_TEXMFMAIN 0 || ~ $MT_TEXMFMAIN '')
	MT_TEXMFMAIN=`{kpsewhich --expand-path'=$TEXMFMAIN'}

if(~ $#MT_MKTEX_OPT_RC 0 || ~ $MT_MKTEX_OPT_RC '')
	MT_MKTEX_OPT_RC=`{kpsewhich --format'=web2c files' mktex.opt.rc}

test -n $MT_MKTEX_OPT_RC || MT_MKTEX_OPT_RC=$MT_TEXMFMAIN/web2c/mktex.opt.rc

if(! test -f $MT_MKTEX_OPT_RC) {
	echo $progname': cannot find mktex.opt; check your installation.' >[1=2]
	exit oops
}

. $MT_MKTEX_OPT_RC

>[1=2] </dev/null {   # brace runs to end of script
# See comments in mktexpk.
name=`{echo $1 | sed 's%.*/%%; s%\.mf$%%'}
rootname=`{echo $name | sed 's/[0-9]*$//'}
pointsize=`{echo $name | sed 's/^'$rootname'//'}

sauterroot=`{kpsewhich b-$rootname.mf >[2]/dev/null}
if(~ $#sauterroot)
	rootfile=$sauterroot
if not
	switch($rootname){
	case wn*
		lhname=`{echo $name | sed 's/^wn/lh'}
		rootfile=`{kpsewhich $lhname.mf >[2]/dev/null}
	case *
		rootfile=`{kpsewhich $rootname.mf >[2]/dev/null}
	}

{ ~ $#rootfile 0 || ! test -f $rootfile } && exit norootfile

ifs=$SEP set x `{$MT_MKTEXNAM $name}
shift

destdir=`{echo $MT_MFNAME | sed 's%/[^/][^/]*$%%'}
test -d $destdir || $MT_MKTEXDIR $destdir || exit nodestdir
cd $destdir >/dev/null >[2=1] || exit nocddestdir

switch($pointsize) {
case ''
	echo $progname': no pointsize.' 
	exit pointsize
case 11
	realsize=10.95444	# \magstephalf
case 14
	realsize=14.4	# \makgstep2
case 17
	realsize=17.28	# \magstep3
case 20
	realsize=20.74	# \magstep4
case 25
	realsize=24.88 # \magstep 5

case ???? ?????
        # The new convention is to have three or four letters for the
        # font name and four digits for the pointsize. The number is
        # pointsize * 100. We effectively divide by 100 by ignoring the
        # last two digits.
	realsize=`{echo $pointsiez | sed 's/(..)$/.\1/'}

case *
	realsize=$pointsize
}

mfname=$name.mf
if(test -r $mfname) {
	echo $progname: $destdir/$mfname already exists
	echo $destdir/$mfname >$STDOUT
	$MT_MKTEXUPD $destdir $mfname
	exit 
}

switch($name){
case ec* tc*
	echo 'if unknown exbase: input exbase fi;
gensize:='$realsize';
generate '$rootname';' > mf$pid.tmp

case dc*
	echo 'if unknown dxbase: input dxbase fi;
gensize:='$realsize';
generate '$rootname';' > mf$pid.tmp

case wn
	echo 'wncoding:=1;
input '$lhname';' >mf$pid.tmp

case *
	echo 'design_size := '$realsize';
input b-'$rootname';' >mf$pid.tmp
}

chmod `{kpsestat -xst,go-w .} mf$pid.tmp
rm -f $mfname
mv mf$pid.tmp $mfname

echo $destdir/$mfname >$STDOUT
echo $progname: $destdir/$mfname: successfully generated >[1=2]
$MT_MKTEXUPD $destdir $mfname
exit
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.