ps_include.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. static char *PS_head[] = {
  2. "%ps_include: begin\n",
  3. "save\n",
  4. "/ed {exch def} def\n",
  5. "{} /showpage ed\n",
  6. "{} /copypage ed\n",
  7. "{} /erasepage ed\n",
  8. "{} /letter ed\n",
  9. "currentdict /findfont known systemdict /findfont known and {\n",
  10. " /findfont systemdict /findfont get def\n",
  11. "} if\n",
  12. "36 dict dup /PS-include-dict-dw ed begin\n",
  13. "/context ed\n",
  14. "count array astore /o-stack ed\n",
  15. "%ps_include: variables begin\n",
  16. 0
  17. };
  18. static char *PS_setup[] = {
  19. "%ps_include: variables end\n",
  20. "{llx lly urx ury} /bbox ed\n",
  21. "{newpath 2 index exch 2 index exch dup 6 index exch\n",
  22. " moveto 3 {lineto} repeat closepath} /boxpath ed\n",
  23. "{dup mul exch dup mul add sqrt} /len ed\n",
  24. "{2 copy gt {exch} if pop} /min ed\n",
  25. "{2 copy lt {exch} if pop} /max ed\n",
  26. "{transform round exch round exch A itransform} /nice ed\n",
  27. "{6 array} /n ed\n",
  28. "n defaultmatrix n currentmatrix n invertmatrix n concatmatrix /A ed\n",
  29. "urx llx sub 0 A dtransform len /Sx ed\n",
  30. "0 ury lly sub A dtransform len /Sy ed\n",
  31. "llx urx add 2 div lly ury add 2 div A transform /Cy ed /Cx ed\n",
  32. "rot dup sin abs /S ed cos abs /C ed\n",
  33. "Sx S mul Sy C mul add /H ed\n",
  34. "Sx C mul Sy S mul add /W ed\n",
  35. "sy H div /Scaley ed\n",
  36. "sx W div /Scalex ed\n",
  37. "s 0 eq {Scalex Scaley min dup /Scalex ed /Scaley ed} if\n",
  38. "sx Scalex W mul sub 0 max ax 0.5 sub mul cx add /cx ed\n",
  39. "sy Scaley H mul sub 0 max ay 0.5 sub mul cy add /cy ed\n",
  40. "urx llx sub 0 A dtransform exch atan rot exch sub /rot ed\n",
  41. "n currentmatrix initgraphics setmatrix\n",
  42. "cx cy translate\n",
  43. "Scalex Scaley scale\n",
  44. "rot rotate\n",
  45. "Cx neg Cy neg translate\n",
  46. "A concat\n",
  47. "bbox boxpath clip newpath\n",
  48. "w 0 ne {gsave bbox boxpath 1 setgray fill grestore} if\n",
  49. "end\n",
  50. "gsave\n",
  51. "%ps_include: inclusion begin\n",
  52. 0
  53. };
  54. static char *PS_tail[] = {
  55. "%ps_include: inclusion end\n",
  56. "grestore\n",
  57. "PS-include-dict-dw begin\n",
  58. "o 0 ne {gsave A defaultmatrix /A ed llx lly nice urx ury nice\n",
  59. " initgraphics 0.1 setlinewidth boxpath stroke grestore} if\n",
  60. "clear o-stack aload pop\n",
  61. "context end restore\n",
  62. "%ps_include: end\n",
  63. 0
  64. };