.key NAME/a,DPI/a,BDPI/a,MAG/a,MODE/a

; This script file makes a new TeX PK font, because one wasn't
; found.  Parameters are:
;
; name dpi bdpi magnification mode
;
; `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 Metafont as the magnification.
;  `mode'	  - is the mode to pass to Metafont.
;
; Note that this file must execute Metafont, and then gftopk,
; and place the result in the correct location for the PostScript
; driver to find it subsequently. If this doesn't work, it will
; be evident because MF will be invoked over and over again.
;

Set METAFONT 	mf:bin/virmf
Set GFTOPK	mf:bin/gftopk
Set TEXDIR 	TeX
Set FONTDIR 	texfonts
Set TFMDIR 	tfm
Set PKDIR 	pk
Set TMPDIR 	RAM:
Set DESTDIR	$TEXDIR:$FONTDIR/$PKDIR/<MODE>/<DPI>
Set FULLFONT	$DESTDIR/<NAME>.<DPI>pk
Set FULLTFM	$TEXDIR:$FONTDIR/$TFMDIR/<NAME>.tfm

If EXISTS $FULLFONT
 Echo "$FULLFONT already exists!"
 Skip EndMakeTeXPK
EndIf

If NOT EXISTS $DESTDIR
 Makedir $DESTDIR
 Echo "Directory $DESTDIR created!"
EndIf

cd $TMPDIR

; Calling Metafont
$METAFONT "\mode:=<MODE>; mag:=<MAG>; scrollmode; input <NAME>"

; Convert gf file into pk file
$GFTOPK -v <NAME>.<DPI>gf $DESTDIR/<NAME>.<DPI>pk

If NOT EXISTS $FULLTFM
 Copy <NAME>.tfm $FULLTFM clone
 Echo "TFM file for <NAME> copied!"
EndIf

delete <NAME>.tfm <NAME>.<DPI>gf <NAME>.log quiet

Lab EndMakeTeXPK

UnSet METAFONT
UnSet GFTOPK
UnSet TEXDIR
UnSet FONTDIR
UnSet TFMDIR
UnSet PKDIR
UnSet TMPDIR
UnSet DESTDIR
UnSet FULLFONT
UnSet FULLTFM
