--- /root/scripts/teTeX-0.4/MakeTeXPK	Sun Feb 23 22:12:05 1997
+++ /home/ft/freetype/contrib/ttf2pk/scripts/teTeX-0.4/MakeTeXPK	Sat Sep  5 07:57:34 1998
@@ -80,6 +80,9 @@
 : ${MAKETEXDIR=$TEXMF/maketex}
 export TEXMF MAKETEXDIR
 
+unset cmd
+unset psline
+
 # grep for the font in $PSMAPFILE, if some ps-to-pk is claimed to be supported.
 # We have to figure out the name of the base font -- $NAME is probably
 # something like pplr, but it's rpplr or pplr0 or pplr8r that's in psfonts.map.
@@ -91,7 +94,40 @@
   # some installations have set up gs in such a way that creating files
   # is only allowed if the parameter -DNOSAFER is used:
   GS_OPTIONS=-DNOSAFER; export GS_OPTIONS
-else
+fi
+
+# test for TTF fonts
+if test -z "$cmd"; then
+  ttf2pk -q $NAME $DPI
+  errstatus=$?
+
+  if test $errstatus -ne 2; then
+    if test $errstatus -ne 0; then
+      echo "ttf2pk failed" >&2
+      exit 1
+    fi
+    MODE=ttf2pk		# preferred mode for TDS would be `modeless'
+    cmd=true
+    psline=ttf2pk	# suppress gftopk call
+  fi
+fi
+
+# test for HBF fonts
+if test -z "$cmd"; then
+  hbf2gf -q -p $NAME $DPI
+  errstatus=$?
+
+  if test $errstatus -ne 2; then
+    if test $errstatus -ne 0; then
+      echo "hbf2gf failed" >&2
+      exit 1
+    fi
+    MODE=hbf2gf		# preferred mode for TDS would be `modeless'
+    cmd=true
+  fi
+fi
+
+if test -z "$cmd"; then
   # If an explicit mode is not supplied, try to guess. You can get a
   # list of extant modes from ftp.cs.umb.edu:pub/tex/modes.mf.
   if test -z "$MODE" || test "$MODE" = default; then
@@ -141,7 +177,7 @@
   { echo "$progname: could not mkdir $PKDESTDIR."; exit 1; }'
 eval "$mdir"
 
-echo "$progname: Running $cmd"
+test "$cmd" = true || echo "$progname: Running $cmd"
 $cmd </dev/null || { echo "$progname: \`$cmd' failed." >&2; exit 1; }
 if test -z "$psline"; then  
   test -r $GFNAME ||
