home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume25 / dvi / patch02 / MakeTeXPK next >
Encoding:
Text File  |  1991-11-11  |  2.3 KB  |  97 lines

  1. #!/bin/sh -x
  2. #   @(#)$Header: MakeTeXPK,v 1.2 91/08/19 17:53:48 hmgr Exp $
  3. #   @(#)Based on labrea.stanford.edu:/pub/dvips547.tar.Z dated Jan 27 02:14 size 244319
  4. #
  5. #   This script file makes a new TeX PK font, because one wasn't
  6. #   found.  Parameters are:
  7. #
  8. #   name dpi bdpi magnification [mode]
  9. #
  10. #   `name' is the name of the font, such as `cmr10'.  `dpi' is
  11. #   the resolution the font is needed at.  `bdpi' is the base
  12. #   resolution, useful for figuring out the mode to make the font
  13. #   in.  `magnification' is a string to pass to MF as the
  14. #   magnification.  `mode', if supplied, is the mode to use.
  15. #
  16. #   Note that this file must execute Metafont, and then gftopk,
  17. #   and place the result in the correct location for the PostScript
  18. #   driver to find it subsequently.  If this doesn't work, it will
  19. #   be evident because MF will be invoked over and over again.
  20. #
  21. #   Of course, it needs to be set up for your site.
  22. #
  23. # TEMPDIR needs to be unique for each process because of the possibility
  24. # of simultaneous processes running this script.
  25. TEMPDIR=/tmp/mtpk.$$
  26. NAME=$1
  27. DPI=$2
  28. BDPI=$3
  29. MAG=$4
  30. MODE=$5
  31.  
  32. umask 0
  33.  
  34. if test "$MODE" = ""
  35. then
  36.    if test $BDPI = 300
  37.    then
  38.       MODE=laser
  39.    elif test $BDPI = 1270
  40.    then
  41.       MODE=lino
  42.    else
  43.       echo "I don't know the mode for $BDPI"
  44.       echo "Have your system admin update MakeTeXPK"
  45.       exit 1
  46.    fi
  47. fi
  48.  
  49. #  Something like the following is useful with TeX from hpdtl.ctgsc.hp.com
  50. PATH=$PATH:/usr/lib/tex/bin
  51. MFINPUTS=/usr/lib/tex/cm:/usr/lib/tex/mf:/usr/lib/tex/macros
  52. export MFINPUTS
  53. MAGDIR=`dc <<!
  54. 4 k $DPI $BDPI / .0005 + 1000 * 0 k 1 / 3 k 1000 / p
  55. !
  56. `
  57. DESTDIR=/usr/lib/tex/fontbits/$MODE/$MAGDIR
  58. GFNAME=$NAME.$DPI'gf'
  59. PKNAME=$NAME.'pk'
  60.  
  61. # Clean up on normal or abnormal exit
  62. trap "cd /; rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15
  63.  
  64.  
  65. if test ! -d $DESTDIR
  66. then
  67.    mkdir $DESTDIR
  68. fi
  69.  
  70. mkdir $TEMPDIR
  71. cd $TEMPDIR
  72.  
  73. if test -r $DESTDIR/$PKNAME
  74. then
  75.    echo "$DESTDIR/$PKNAME already exists!"
  76.    exit 0
  77. fi
  78.  
  79. echo cmmf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" \\\</dev/null
  80. cmmf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" </dev/null
  81. if test ! -r $GFNAME
  82. then
  83.    echo "Metafont failed for some reason on $GFNAME"
  84.    exit 1
  85. fi
  86.  
  87. gftopk $GFNAME $PKNAME
  88.  
  89. # Install the PK file carefully, since others may be doing the same
  90. # as us simultaneously.
  91.  
  92. mv $PKNAME $DESTDIR/pktmp.$$
  93. cd $DESTDIR
  94. mv pktmp.$$ $PKNAME
  95.  
  96. exit 0
  97.