prolog.ps 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. % make definition operators
  2. /BD {bind def} bind def
  3. /XD {exch def} BD
  4. % make increment and decrement operators
  5. /IN {1 add} BD
  6. /DE {1 sub} BD
  7. % exch sub operator
  8. /XS {exch sub} BD
  9. % newpath operator
  10. /NP {newpath} BD
  11. % newpath moveto operator
  12. /NM {newpath moveto} BD
  13. % moveto operator
  14. /M {moveto} BD
  15. % closepath operator
  16. /CP {closepath} BD
  17. % closepath fill operator
  18. /CF {closepath fill} BD
  19. % lineto operator
  20. /LN {lineto} BD
  21. % divide by 2
  22. /D2 {2 div} BD
  23. % draw a line segment
  24. % assumes x2 y2 x1 y1 on top of stack
  25. /L {moveto LN stroke} BD
  26. /ML {moveto LN } BD
  27. % adds a relative vector to the path
  28. % assumes x2 y2 on top of stack
  29. /V {rlineto} BD
  30. % construct rectangular box path
  31. % assumes l b r t on top of stack
  32. /B {4 1 roll 2 copy 5 index 5 index 8 1 roll
  33. NM LN LN LN closepath} BD
  34. % set line width
  35. % assumes line width is on top of stack
  36. /W {setlinewidth} BD
  37. % stringwidth operator
  38. /SW {stringwidth} BD
  39. % translate operator
  40. /TR {translate} BD
  41. % set current color
  42. % assumes R G B values (0.0 to 1.0) on top of stack
  43. /C {setrgbcolor} BD
  44. % set color to black, line width to 1
  45. /BW {0 0 0 C 1 W} BD
  46. % moveto and show
  47. % assumes text x y on top of stack
  48. /MS {moveto show} BD
  49. % fill interior of current path with current color
  50. /F {gsave fill grestore} BD
  51. % draw current path
  52. /D {stroke} BD
  53. % set font name
  54. % assumes font name is on top of stack
  55. /FN {/fn exch cvn def} BD
  56. % ISO-Latin1 fonts
  57. /isofonts 100 dict def
  58. % set font
  59. % assumes size is on top of stack
  60. /SF {isofonts fn known {} {
  61. fn dup length string cvs
  62. dup length 4 add string 1 index 1 index copy pop
  63. exch length 1 index exch (-ISO) putinterval cvn
  64. fn findfont dup length dict copy
  65. dup /FID undef
  66. dup /FontName 3 index put
  67. dup /Encoding ISOLatin1Encoding put
  68. 1 index exch definefont pop
  69. isofonts fn 3 -1 roll put
  70. } ifelse
  71. isofonts fn get findfont exch scalefont setfont} BD
  72. % initialize font to Helvetica, size = 10
  73. (Helvetica) FN 10 SF
  74. % initialize the text box path
  75. /ZB {0 0 NM gsave} BD
  76. % get the path of the text box
  77. /PB {dup false charpath flattenpath pathbbox
  78. /bt exch mg add def
  79. /br exch mg add def
  80. /bb exch mg sub def
  81. /bl exch mg sub def} BD
  82. % set the text box path
  83. /TB {bl bb br bt B} BD
  84. % text in box
  85. /TIB {0 0 MS grestore} BD
  86. % procs for text box path
  87. /LTX {mg add} BD
  88. /RTX {mg add br bl sub sub} BD
  89. /CTX {mg add br bl sub D2 sub} BD
  90. /UTY {mg add bt bb sub sub} BD
  91. /LTY {mg add} BD
  92. /CTY {mg add bt bb sub D2 sub} BD
  93. % proc used for highlight color
  94. % (temporarily change miter limit to avoid the M-problem)
  95. % /HC {0 0 NM dup false charpath gsave 2 setmiterlimit stroke grestore} BD
  96. % proc used for highlight color
  97. % (temporarily change line join style so highlight is rounded)
  98. /HC {0 0 NM dup false charpath gsave 1 setlinejoin stroke grestore} BD
  99. % proc used before included EPS file
  100. /BeginEPSF {
  101. /inc_state save def
  102. /dict_count countdictstack def
  103. /op_count count 1 sub def
  104. userdict begin
  105. /showpage { } def
  106. 0 setgray 0 setlinecap
  107. 1 setlinewidth 0 setlinejoin
  108. 10 setmiterlimit [ ] 0 setdash newpath
  109. /language level where
  110. {pop languagelevel
  111. 1 ne
  112. {false setstrokeadjust false setoverprint
  113. } if
  114. } if
  115. } bind def
  116. % proc used to restore PS state after included EPS file
  117. /EndEPSF {
  118. count op_count sub {pop} repeat
  119. countdictstack dict_count sub {end} repeat
  120. inc_state restore
  121. } bind def