home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / tex / pastex / source / dvips / maketexpk < prev    next >
Encoding:
Text File  |  1994-02-13  |  3.6 KB  |  172 lines

  1. #!/bin/sh
  2. #
  3. #  Do not run this script, or dvips, as setuid programs!  This will
  4. #  result in a major security hole!
  5. #
  6. #   This script file makes a new TeX PK font, because one wasn't
  7. #   found.  Parameters are:
  8. #
  9. #   name dpi bdpi magnification [mode [subdir]]
  10. #
  11. #   `name' is the name of the font, such as `cmr10'.  `dpi' is
  12. #   the resolution the font is needed at.  `bdpi' is the base
  13. #   resolution, useful for figuring out the mode to make the font
  14. #   in.  `magnification' is a string to pass to MF as the
  15. #   magnification.  `mode', if supplied, is the mode to use.
  16. #
  17. #   Note that this file must execute Metafont, and then gftopk,
  18. #   and place the result in the correct location for the PostScript
  19. #   driver to find it subsequently.  If this doesn't work, it will
  20. #   be evident because MF will be invoked over and over again.
  21. #
  22. #   Of course, it needs to be set up for your site.
  23. #
  24. TEXDIR=/usr/lib/tex
  25. LOCALDIR=/LocalLibrary/Fonts/TeXFonts
  26. DESTDIR=$LOCALDIR/pk
  27. #
  28. # TEMPDIR needs to be unique for each process because of the possibility
  29. # of simultaneous processes running this script.
  30. #
  31. if test "$TMPDIR" = ""
  32. then
  33.    TEMPDIR=/tmp/mtpk.$$
  34. else
  35.    TEMPDIR=$TMPDIR/mtpk.$$
  36. fi
  37. NAME=$1
  38. DPI=$2
  39. BDPI=$3
  40. MAG=$4
  41. MODE=$5
  42. #
  43. if test "$MODE" = "default"
  44. then
  45.    MODE=""
  46. fi
  47. #
  48. #   Prevent display under the X Window System.  Except it doesn't always
  49. #   work; some sh'ells don't seem to understand unset.  There are also some
  50. #   versions of METAFONT that don't work if the DISPLAY isn't set and
  51. #   the term type is set to xterm.
  52. #
  53. # unset DISPLAY
  54. umask 0
  55.  
  56. if test "$MODE" = ""
  57. then
  58.    if test $BDPI = 300
  59.    then
  60.       MODE=imagen
  61.    elif test $BDPI = 600
  62.    then
  63.       MODE=imagen
  64.       MAG="2*($MAG)"
  65.    elif test $BDPI = 200
  66.    then
  67.       MODE=FAX
  68.    elif test $BDPI = 360
  69.    then
  70.       MODE=nextII
  71.    elif test $BDPI = 400
  72.    then
  73.       MODE=nexthi
  74.    elif test $BDPI = 100
  75.    then
  76.       MODE=nextscreen
  77.    elif test $BDPI = 72
  78.    then
  79.       MODE=seventwo
  80.    elif test $BDPI = 635
  81.    then
  82.       MODE=linolo
  83.    elif test $BDPI = 1270
  84.    then
  85.       MODE=linohi
  86.    elif test $BDPI = 2540
  87.    then
  88.       MODE=linosuper
  89.    else
  90.       echo "I don't know the mode for $BDPI"
  91.       echo "Have your system admin update MakeTeXPK"
  92.       exit 1
  93.    fi
  94. fi
  95.  
  96. #  Something like the following is useful at some sites.
  97. # DESTDIR=/usr/local/lib/tex/fonts/pk.$MODE
  98. GFNAME=$NAME.$DPI'gf'
  99. PKNAME=$NAME.$DPI'pk'
  100.  
  101. # Clean up on normal or abnormal exit
  102. trap "cd /; rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15
  103.  
  104.  
  105. if test ! -d $DESTDIR
  106. then
  107.    mkdir $DESTDIR
  108.    chmod 777 $DESTDIR
  109. fi
  110.  
  111. if test "$6" != ""
  112. then
  113.    DESTDIR=$DESTDIR"$6"
  114.    if test ! -d $DESTDIR
  115.    then
  116.       mkdir $DESTDIR
  117.       chmod 777 $DESTDIR
  118.    fi
  119. fi
  120.  
  121. # added by gwb, to allow searching in current dir before cd'ing
  122. if test "$MFINPUTS" != ""
  123. then
  124.    MFINPUTS=$MFINPUTS:`pwd`; export MFINPUTS
  125. fi
  126. mkdir $TEMPDIR
  127. cd $TEMPDIR
  128.  
  129. if test -r $DESTDIR/$PKNAME
  130. then
  131.    echo "$DESTDIR/$PKNAME already exists!"
  132.    exit 0
  133. fi
  134.  
  135. # check also in the standard place
  136.  
  137. if test "$6" = ""
  138. then
  139.    if test -r $TEXDIR/fonts/pk/$PKNAME
  140.    then
  141.       echo $TEXDIR/fonts/pk/$PKNAME already exists!
  142.       exit 0
  143.    fi
  144. else
  145.    if test -r $TEXDIR/fonts/pk/$6"$PKNAME"
  146.    then
  147.       echo $TEXDIR/fonts/pk/$6"$PKNAME" already exists!
  148.       exit 0
  149.    fi
  150. fi
  151.  
  152. unset DISPLAY
  153. echo "mf \"\\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME\" </dev/null"
  154. mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" </dev/null
  155. if test ! -r $GFNAME
  156. then
  157.    echo "Metafont failed for some reason on $GFNAME"
  158.    exit 1
  159. fi
  160.  
  161. gftopk -v ./$GFNAME ./$PKNAME
  162.  
  163. # Install the PK file carefully, since others may be doing the same
  164. # as us simultaneously.
  165.  
  166. mv $PKNAME $DESTDIR/pktmp.$$
  167. cd $DESTDIR
  168. mv pktmp.$$ $PKNAME
  169. chmod a+r $PKNAME
  170.  
  171. exit 0
  172.