printfont 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/rc
  2. # Formatted dump of encoded characters in one or more PostScript fonts.
  3. # Arguments should be PostScript font names or the word all, which dumps
  4. # all ROM and disk based fonts.
  5. #
  6. POSTLIB=/sys/lib/postscript/prologues
  7. PROLOGUE=$POSTLIB/printfont.ps
  8. OPTIONS=''
  9. COPYFILE=''
  10. MODE=portrait
  11. FONTENCODING=Default
  12. NONCONFORMING='%!PS'
  13. ENDPROLOG='%%EndProlog'
  14. BEGINSETUP='%%BeginSetup'
  15. ENDSETUP='%%EndSetup'
  16. TRAILER='%%Trailer'
  17. SETUP=setup
  18. while (! ~ $#* 0 && ~ $1 -*) {
  19. switch ($1) {
  20. case -a; shift; OPTIONS=$OPTIONS' /axescount $1 def'
  21. case -a*; OPTIONS=$OPTIONS' /axescount '`{echo $1 | sed s/-a//}' def'
  22. case -b; shift; OPTIONS=$OPTIONS' /radix '$1' def'
  23. case -b*; OPTIONS=$OPTIONS' /radix '`{echo $1 | sed s/-b//}' def'
  24. case -c; shift; OPTIONS=$OPTIONS' /#copies '$1' store'
  25. case -c*; OPTIONS=$OPTIONS' /#copies '`{echo $1 | sed s/-c//}' store'
  26. case -f; shift; OPTIONS=$OPTIONS' /labelfont /'$1' def'
  27. case -f*; OPTIONS=$OPTIONS' /labelfont /'`{echo $1 | sed s/-f//}' def'
  28. case -g; shift; OPTIONS=$OPTIONS' /graynotdef '$1' def'
  29. case -g*; OPTIONS=$OPTIONS' /graynotdef '`{echo $1 | sed s/-g//}' def'
  30. case -p; shift; MODE=$1
  31. case -p*; MODE=`{echo $1 | sed s/-p//}
  32. case -q; OPTIONS=$OPTIONS' /longnames false def /charwidth false def'
  33. case -m; shift; OPTIONS=$OPTIONS' /magnification '$1' def'
  34. case -m*; OPTIONS=$OPTIONS' /magnification '`{echo $1 | sed s/-m//}' def'
  35. case -v; OPTIONS=$OPTIONS' /longnames true def /charwidth true def'
  36. case -w; shift; OPTIONS=$OPTIONS' /linewidth '$1' def'
  37. case -w*; OPTIONS=$OPTIONS' /linewidth '`{echo $1 | sed s/-w//}' def'
  38. case -x; shift; OPTIONS=$OPTIONS' /xoffset '$1' def'
  39. case -x*; OPTIONS=$OPTIONS' /xoffset '`{echo $1 | sed s/-x//}' def'
  40. case -y; shift; OPTIONS=$OPTIONS' /yoffset '$1' def'
  41. case -y*; OPTIONS=$OPTIONS' /yoffset '`{echo $1 | sed s/-y//}' def'
  42. case -z; shift; OPTIONS=$OPTIONS' /zerocell '$1' def'
  43. case -z*; OPTIONS=$OPTIONS' /zerocell '`{echo $1 | sed s/-z//}' def'
  44. case -C; shift; COPYFILE=$COPYFILE' '$1
  45. case -C*; COPYFILE=$COPYFILE' '`{echo $1 | sed s/-C//}
  46. case -E; shift; FONTENCODING=$1
  47. case -E*; FONTENCODING=`{echo $1 | sed s/-E//}
  48. case -L; shift; PROLOGUE=$1
  49. case -L*; PROLOGUE=`{echo $1 | sed s/-L//}
  50. case -*; echo $0:' illegal option '$1 >[1=2]; exit 1
  51. }
  52. shift
  53. }
  54. switch ($MODE) {
  55. case l*; OPTIONS=$OPTIONS' /landscape true def'
  56. case *; OPTIONS=$OPTIONS' /landscape false def'
  57. }
  58. echo $NONCONFORMING
  59. cat $PROLOGUE
  60. echo $ENDPROLOG
  61. echo $BEGINSETUP
  62. if (~ $#COPYFILE 0 || ~ $COPYFILE '') COPYFILE=/dev/null
  63. cat $COPYFILE
  64. echo $OPTIONS
  65. switch ($FONTENCODING) {
  66. case /*; cat $FONTENCODING
  67. case ?*; cat $POSTLIB^/$FONTENCODING^.enc >[2]/dev/null
  68. }
  69. echo $SETUP
  70. echo $ENDSETUP
  71. for (i) {
  72. switch ($i) {
  73. case all; echo AllFonts
  74. case /*; echo $i' PrintFont'
  75. case ?*; echo /$i' PrintFont'
  76. }
  77. }
  78. echo $TRAILER