#!/bin/csh -f


echo "\
This script runs metafont and gftopk to produce the \
following fonts / family / shapes:\
\
  *********************************************************\
  etc - see what you get :-)\
        capbas package (7 fonts in here)\
        duerer package (6 fonts in here)\
        twcal package\
        va package\
  *********************************************************\
\
Give metafont mode as first argument (default = localfont)\
\
Volker Kuhlmann \
    28 March 1997\
v.kuhlmann@elec.canterbury.ac.nz\
"

# CHANGELOG
#
# 28 Mar 97 (VK)
#	Created.


if ( $#argv > 0 ) set MODE=$1
if ( ! $?MODE ) set MODE=localfont
echo ""
echo "**********************************"
echo 'metafont mode is set to: '$MODE
echo "**********************************"
echo ""

set MFARG='\mode='"$MODE"'; \scrollmode;'


# ASCII package (does not actually have any .mf files with it)
if ( 0  &&  "$2" == ""  ||  `echo $argv[2-] | grep -w ascii` != "" ) then
mf "$MFARG"' \mag=magstep(0);'		input ascii-10
mf "$MFARG"' \mag=magstep(0.5);'	input ascii-10
mf "$MFARG"' \mag=magstep(1);'		input ascii-10
mf "$MFARG"' \mag=magstep(2);'		input ascii-10
mf "$MFARG"' \mag=magstep(3);'		input ascii-10
mf "$MFARG"' \mag=magstep(4);'		input ascii-10
mf "$MFARG"' \mag=magstep(5);'		input ascii-10
endif

# CAPBAS package
if ( "$2" == ""  ||  `echo $argv[2-] | grep -w capbas` != "" ) then
mf "$MFARG"' \mag=magstep(0);'		input capbas
mf "$MFARG"' \mag=magstep(0);'		input capbasd
mf "$MFARG"' \mag=magstep(0);'		input d7seg
mf "$MFARG"' \mag=magstep(0);'		input deseg
mf "$MFARG"' \mag=magstep(0);'		input flyspec
mf "$MFARG"' \mag=magstep(0);'		input necker
mf "$MFARG"' \mag=magstep(0);'		input simfon
endif

# DUERER package
if ( "$2" == ""  ||  `echo $argv[2-] | grep -w duerer` != "" ) then
mf "$MFARG"' \mag=magstep(0);'		input cdb10
mf "$MFARG"' \mag=magstep(0);'		input cdi10
mf "$MFARG"' \mag=magstep(0);'		input cdr10
mf "$MFARG"' \mag=magstep(0);'		input cdsl10
mf "$MFARG"' \mag=magstep(0);'		input cdss10
mf "$MFARG"' \mag=magstep(0);'		input cdtt10
endif

# HERSHEY package
# script, and 3 styles of gothic
if ( "$2" == ""  ||  `echo $argv[2-] | grep -w hershey` != "" ) then
echo "NOTE: need to make hgoe.mf, hgog.mf, hgoi.mf first\!\!\!"
echo "      Use the patch for the makefile, and run:"
echo "          make"
echo "          ./xhershey -X hgoe.spec > hgoe.mf   [for each {hgoe,hgog,hgoi}]"
cmmf "$MFARG"' \mag=magstep(0);'	input hscs10
cmmf "$MFARG"' \mag=magstep(0);'	input hgoe10
cmmf "$MFARG"' \mag=magstep(0);'	input hgog10
cmmf "$MFARG"' \mag=magstep(0);'	input hgoi10
endif

# TWCAL package
if ( "$2" == ""  ||  `echo $argv[2-] | grep -w twcal` != "" ) then
mf "$MFARG"' \mag=magstep(0);'		input twcal14
mf "$MFARG"' \mag=magstep(0.5);'	input twcal14
mf "$MFARG"' \mag=magstep(1);'		input twcal14
mf "$MFARG"' \mag=magstep(2);'		input twcal14
mf "$MFARG"' \mag=magstep(3);'		input twcal14
mf "$MFARG"' \mag=magstep(4);'		input twcal14
mf "$MFARG"' \mag=magstep(5);'		input twcal14
endif

# VA package
if ( "$2" == ""  ||  `echo $argv[2-] | grep -w va` != "" ) then
# The magsteps -3, -2.5, -2, -1.5, -1, 0, 1, 2, 3 are for making the
# standard TeX sizes from a 14.4pt font.
# ca/vacal are 14pt - calculate again...
mf "$MFARG"' \mag=343/600;'		input va14	# 8.33pt
mf "$MFARG"' \mag=386/600;'		input va14	# 9.13pt
mf "$MFARG"' \mag=429/600;'		input va14	# 10pt
mf "$MFARG"' \mag=469/600;'		input va14	# 10.95pt
mf "$MFARG"' \mag=514/600;'		input va14	# 12pt
mf "$MFARG"' \mag=617/600;'		input va14	# 14.4pt [14pt!]
mf "$MFARG"' \mag=741/600;'		input va14	# 17.28pt
mf "$MFARG"' \mag=889/600;'		input va14	# 20.74pt
mf "$MFARG"' \mag=1066/600;'		input va14	# 24.88pt
#
mf "$MFARG"' \mag=343/600;'		input vacal14	# 8.33pt
mf "$MFARG"' \mag=386/600;'		input vacal14	# 9.13pt
mf "$MFARG"' \mag=429/600;'		input vacal14	# 10pt
mf "$MFARG"' \mag=469/600;'		input vacal14	# 10.95pt
mf "$MFARG"' \mag=514/600;'		input vacal14	# 12pt
mf "$MFARG"' \mag=617/600;'		input vacal14	# 14.4pt [14pt!]
mf "$MFARG"' \mag=741/600;'		input vacal14	# 17.28pt
mf "$MFARG"' \mag=889/600;'		input vacal14	# 20.74pt
mf "$MFARG"' \mag=1066/600;'		input vacal14	# 24.88pt
endif

#


echo ""
echo "Metafont finished."
echo ""



echo "Now running GFtoPK."

# note this requires csh or tcsh
foreach file (*gf)
  echo $file
  gftopk $file
end
#ls *gf | xargs -n 1 gftopk

echo "GFtoPK finished."
echo ""

echo ""
echo "To complete the font installation, do the following:"
echo "  copy all .tfm-files into the tfm directory"
echo "  copy all .pk-files into the pk-directory"
echo "  delete all .gf files."
echo ""
echo "Have a nice day."
echo ""