shade.ps 905 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. %
  2. % Shading support - primarily for ASCII file translators.
  3. %
  4. /grays [0.98 0.9 0.75 0.6] def
  5. /setshade {
  6. /level exch def
  7. level 0 le {
  8. /textgray 0 def
  9. /backgray 1 def
  10. }{
  11. /backgray level grays length gt
  12. {/textgray 1 def 0}
  13. {/textgray 0 def grays level 1 sub get}
  14. ifelse def
  15. } ifelse
  16. textgray setgray
  17. /dY1 0 def
  18. /dY2 0 def
  19. } bind def
  20. /drawrvbox {
  21. /x2 exch charwidth mul def
  22. /x1 exch charwidth mul def
  23. x1 x2 lt {
  24. dup % expects y on top
  25. /y1 exch linespace mul def
  26. /y2 y1 def
  27. dY1 0 eq dY2 0 eq and {
  28. currentfont /FontBBox get aload pop
  29. 160 sub
  30. currentfont /FontMatrix get dtransform /dY2 exch def pop
  31. 100 add
  32. currentfont /FontMatrix get dtransform /dY1 exch def pop
  33. } if
  34. /y1 y1 dY1 add def
  35. /y2 y2 dY2 add def
  36. backgray setgray
  37. newpath
  38. x1 y1 moveto
  39. x2 y1 lineto
  40. x2 y2 lineto
  41. x1 y2 lineto
  42. closepath fill
  43. } if
  44. textgray setgray
  45. } bind def