home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-src.tgz / tar.out / contrib / unixtex / web2c / lib / MakeTeXTFM < prev    next >
Text File  |  1996-09-28  |  2KB  |  75 lines

  1. #!/bin/sh
  2. #
  3. #   This script file makes a new TeX TFM font, because one wasn't
  4. #   found.  Usage:
  5. #
  6. #   MakeTFM name [mode]
  7. #
  8. #   `name' is the name of the font, such as `cmr10'.
  9. #   `mode', if supplied, is the mode to use.
  10. #
  11. #   Note that this file must execute Metafont, and place the result 
  12. #   in the correct location.
  13. #
  14. #   Of course, it needs to be set up for your site.
  15. #
  16. # TEMPDIR needs to be unique for each process because of the possibility
  17. # of simultaneous processes running this script.
  18. ##DESTDIR=/LocalLibrary/Fonts/TeXFonts/pk
  19. ##DESTDIR=/usr/local/lib/tex/localfonts
  20. TEXDIR=/home/estwk1/pnoma/lib/tex
  21. LOCALDIR=$TEXDIR/fonts
  22. DESTDIR=$LOCALDIR/tfmtmp
  23. TEMPDIR=$TMPDIR/mttfm.$$
  24. NAME=`echo $1 | sed 's/\.tfm$//'`
  25. MODE=$2
  26.  
  27. umask 0
  28.  
  29. if test "$MODE" = ""
  30. then MODE=nullmode
  31. fi
  32.  
  33. TFMNAME=$NAME.$DPI'tfm'
  34.  
  35. # Clean up on normal or abnormal exit
  36. trap "cd /; rm -rf $TEMPDIR $DESTDIR/tfmtmp.$$" 0 1 2 15
  37.  
  38. if test ! -d $DESTDIR
  39. then
  40.    mkdir $DESTDIR
  41. fi
  42.  
  43. mkdir $TEMPDIR
  44. cd $TEMPDIR
  45.  
  46. if test -r $DESTDIR/$TFMNAME
  47. then
  48.    echo "$DESTDIR/$TFMNAME already exists!"
  49.    exit 0
  50. fi
  51.  
  52. # check also in the standard place
  53.  
  54. if test -r /usr/local/lib/tex/fonts/$TFMNAME
  55. then
  56.    echo /usr/local/lib/tex/fonts/$TFMNAME already exists!
  57.    exit 0
  58. fi
  59.  
  60. echo mf "\mode:=$MODE; mag:=1; scrollmode; input $NAME" \\\</dev/null
  61. mf "\mode:=$MODE; mag:=1; scrollmode; input $NAME" </dev/null
  62. if test ! -r $TFMNAME
  63. then
  64.    echo "Metafont failed for some reason on $TFMNAME"
  65.    exit 1
  66. fi
  67.  
  68. # Install the TFM file carefully, since others may be doing the same
  69. # as us simultaneously.
  70.  
  71. chmod 644 $TFMNAME
  72. mv $TFMNAME $DESTDIR/tfmtmp.$$
  73. cd $DESTDIR
  74. mv tfmtmp.$$ $TFMNAME
  75.