fixfonts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/sh
  2. # Make links named `lcircle10' for all TFM and GF/PK files, if no
  3. # lcircle10 files already exist.
  4. # Don't override definition of prefix and/or libdir if they are
  5. # already defined in the environment.
  6. if test "z${prefix}" = "z" ; then
  7. prefix=/usr/local
  8. else
  9. # prefix may contain references to other variables, thanks to make.
  10. eval prefix=\""${prefix}"\"
  11. fi
  12. if test "z${libdir}" = "z" ; then
  13. libdir="${prefix}/lib/tex"
  14. else
  15. # libdir may contain references to other variables, thanks to make.
  16. eval libdir=\""${libdir}"\"
  17. fi
  18. texlibdir="${libdir}"
  19. texfontdir="${texlibdir}/fonts"
  20. # Directories for the different font formats, in case they're not all
  21. # stored in one place.
  22. textfmdir="${textfmdir-${texfontdir}}"
  23. texpkdir="${texpkdir-${texfontdir}}"
  24. texgfdir="${texgfdir-${texfontdir}}"
  25. test "z${TMPDIR}" = "z" && TMPDIR="/tmp"
  26. tempfile="${TMPDIR}/circ$$"
  27. tempfile2="${TMPDIR}/circ2$$"
  28. # EXIT SIGHUP SIGINT SIGQUIT SIGTERM
  29. #trap 'rm -f "${tempfile}" "${tempfile2}"' 0 1 2 3 15
  30. # Find all the fonts with names that include `circle'.
  31. (cd "${texfontdir}"; find . -name '*circle*' -print > "${tempfile}")
  32. # If they have lcircle10.tfm, assume everything is there, and quit.
  33. if grep 'lcircle10\.tfm' "${tempfile}" > /dev/null 2>&1 ; then
  34. echo "Found lcircle10.tfm."
  35. exit 0
  36. fi
  37. # No TFM file for lcircle. Make a link to circle10.tfm if it exists,
  38. # and then make a link to the bitmap files.
  39. grep 'circle10\.tfm' "${tempfile}" > "${tempfile2}" \
  40. || {
  41. echo "I can't find any circle fonts in ${texfontdir}.
  42. If it isn't installed somewhere else, you need to get the Metafont sources
  43. from somewhere, e.g., labrea.stanford.edu:pub/tex/latex/circle10.mf, and
  44. run Metafont on them."
  45. exit 1
  46. }
  47. # We have circle10.tfm. (If we have it more than once, take the first
  48. # one.) Make the link.
  49. tempfile2_line1="`sed -ne '1p;q' \"${tempfile2}\"`"
  50. ln "${tempfile2_line1}" "${textfmdir}/lcircle10.tfm"
  51. echo "Linked to ${tempfile2_line1}."
  52. # Now make a link for the PK files, if any.
  53. (cd "${texpkdir}"
  54. for f in `grep 'circle10.*pk' "${tempfile}"` ; do
  55. set - `echo "$f" \
  56. | sed -ne '/\//!s/^/.\//;s/\(.*\)\/\([^\/][^\/]*\)$/\1 \2/;p'`
  57. ln "$f" "${1}/l${2}"
  58. echo "Linked to $f."
  59. done
  60. )
  61. # And finally for the GF files.
  62. (cd "${texgfdir}"
  63. for f in `grep 'circle10.*gf' "${tempfile}"` ; do
  64. set - `echo "$f" \
  65. | sed -ne '/\//!s/^/.\//;s/\(.*\)\/\([^\/][^\/]*\)$/\1 \2/;p'`
  66. ln "$f" "${1}/l${2}"
  67. echo "Linked to $f."
  68. done
  69. )
  70. # eof