caption.ps 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. %!
  2. % Copyright (C) 1995 Aladdin Enterprises. All rights reserved.
  3. %
  4. % This file is part of AFPL Ghostscript.
  5. %
  6. % AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  7. % distributor accepts any responsibility for the consequences of using it, or
  8. % for whether it serves any particular purpose or works at all, unless he or
  9. % she says so in writing. Refer to the Aladdin Free Public License (the
  10. % "License") for full details.
  11. %
  12. % Every copy of AFPL Ghostscript must include a copy of the License, normally
  13. % in a plain ASCII text file named PUBLIC. The License grants you the right
  14. % to copy, modify and redistribute AFPL Ghostscript, but only under certain
  15. % conditions described in the License. Among other things, the License
  16. % requires that the copyright notice and this notice be preserved on all
  17. % copies.
  18. % $Id: caption.ps,v 1.2 2000/09/19 18:29:11 lpd Exp $
  19. % Add a "caption" to the bottom of each page.
  20. /captionsize 20 def
  21. /caption
  22. { /Helvetica //captionsize selectfont
  23. (Printed by Aladdin's XXYYZZ) show
  24. /Symbol //captionsize selectfont
  25. (\324) show % trademarkserif
  26. /Helvetica //captionsize selectfont
  27. ( product) show
  28. } bind def
  29. 10 dict begin
  30. gsave
  31. initgraphics
  32. clippath pathbbox
  33. pop exch 36 add /by exch def
  34. % We can't use stringwidth, so we have to show and measure.
  35. gsave
  36. 0 0 0 0 rectclip
  37. 0 0 moveto caption currentpoint pop /bw exch def
  38. grestore
  39. add bw sub 2 div /bx exch def
  40. % We don't have the font bbox available, so we guess.
  41. /bh captionsize 1.05 mul def
  42. grestore
  43. /showcaption
  44. { gsave
  45. initgraphics
  46. //bx 9 sub //by 9 sub //bw 18 add //bh 18 add
  47. 1 setgray 4 copy rectfill 0 setgray 1.5 setlinewidth rectstroke
  48. //bx //by moveto //caption exec
  49. grestore
  50. } bind def
  51. << /EndPage [
  52. /showcaption load /exec load
  53. currentpagedevice /EndPage get /exec load
  54. ] cvx
  55. >> setpagedevice
  56. end