ps.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. #pragma once
  2. #include <stddef.h>
  3. static const char *ps_txt[] = {
  4. // clang-format off
  5. "%%BeginProlog\n"
  6. "/DotDict 200 dict def\n"
  7. "DotDict begin\n"
  8. "\n"
  9. "/setupLatin1 {\n"
  10. "mark\n"
  11. "/EncodingVector 256 array def\n"
  12. " EncodingVector 0\n"
  13. "\n"
  14. "ISOLatin1Encoding 0 255 getinterval putinterval\n"
  15. "EncodingVector 45 /hyphen put\n"
  16. "\n"
  17. "% Set up ISO Latin 1 character encoding\n"
  18. "/starnetISO {\n"
  19. " dup dup findfont dup length dict begin\n"
  20. " { 1 index /FID ne { def }{ pop pop } ifelse\n"
  21. " } forall\n"
  22. " /Encoding EncodingVector def\n"
  23. " currentdict end definefont\n"
  24. "} def\n"
  25. "/Times-Roman starnetISO def\n"
  26. "/Times-Italic starnetISO def\n"
  27. "/Times-Bold starnetISO def\n"
  28. "/Times-BoldItalic starnetISO def\n"
  29. "/Helvetica starnetISO def\n"
  30. "/Helvetica-Oblique starnetISO def\n"
  31. "/Helvetica-Bold starnetISO def\n"
  32. "/Helvetica-BoldOblique starnetISO def\n"
  33. "/Courier starnetISO def\n"
  34. "/Courier-Oblique starnetISO def\n"
  35. "/Courier-Bold starnetISO def\n"
  36. "/Courier-BoldOblique starnetISO def\n"
  37. "cleartomark\n"
  38. "} bind def\n"
  39. "\n"
  40. "%%BeginResource: procset graphviz 0 0\n"
  41. "/coord-font-family /Times-Roman def\n"
  42. "/default-font-family /Times-Roman def\n"
  43. "/coordfont coord-font-family findfont 8 scalefont def\n"
  44. "\n"
  45. "/InvScaleFactor 1.0 def\n"
  46. "/set_scale {\n"
  47. " dup 1 exch div /InvScaleFactor exch def\n"
  48. " scale\n"
  49. "} bind def\n"
  50. "\n"
  51. "% styles\n"
  52. "/solid { [] 0 setdash } bind def\n"
  53. "/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def\n"
  54. "/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def\n"
  55. "/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def\n"
  56. "/bold { 2 setlinewidth } bind def\n"
  57. "/filled { } bind def\n"
  58. "/unfilled { } bind def\n"
  59. "/rounded { } bind def\n"
  60. "/diagonals { } bind def\n"
  61. "/tapered { } bind def\n"
  62. "\n"
  63. "% hooks for setting color \n"
  64. "/nodecolor { sethsbcolor } bind def\n"
  65. "/edgecolor { sethsbcolor } bind def\n"
  66. "/graphcolor { sethsbcolor } bind def\n"
  67. "/nopcolor {pop pop pop} bind def\n"
  68. "\n"
  69. "/beginpage { % i j npages\n"
  70. " /npages exch def\n"
  71. " /j exch def\n"
  72. " /i exch def\n"
  73. " /str 10 string def\n"
  74. " npages 1 gt {\n"
  75. " gsave\n"
  76. " coordfont setfont\n"
  77. " 0 0 moveto\n"
  78. " (\\() show i str cvs show (,) show j str cvs show (\\)) show\n"
  79. " grestore\n"
  80. " } if\n"
  81. "} bind def\n"
  82. "\n"
  83. "/set_font {\n"
  84. " findfont exch\n"
  85. " scalefont setfont\n"
  86. "} def\n"
  87. "\n"
  88. "% draw text fitted to its expected width\n"
  89. "/alignedtext { % width text\n"
  90. " /text exch def\n"
  91. " /width exch def\n"
  92. " gsave\n"
  93. " width 0 gt {\n"
  94. " [] 0 setdash\n"
  95. " text stringwidth pop width exch sub text length div 0 text ashow\n"
  96. " } if\n"
  97. " grestore\n"
  98. "} def\n"
  99. "\n"
  100. "/boxprim { % xcorner ycorner xsize ysize\n"
  101. " 4 2 roll\n"
  102. " moveto\n"
  103. " 2 copy\n"
  104. " exch 0 rlineto\n"
  105. " 0 exch rlineto\n"
  106. " pop neg 0 rlineto\n"
  107. " closepath\n"
  108. "} bind def\n"
  109. "\n"
  110. "/ellipse_path {\n"
  111. " /ry exch def\n"
  112. " /rx exch def\n"
  113. " /y exch def\n"
  114. " /x exch def\n"
  115. " matrix currentmatrix\n"
  116. " newpath\n"
  117. " x y translate\n"
  118. " rx ry scale\n"
  119. " 0 0 1 0 360 arc\n"
  120. " setmatrix\n"
  121. "} bind def\n"
  122. "\n"
  123. "/endpage { showpage } bind def\n"
  124. "/showpage { } def\n"
  125. "\n"
  126. "/layercolorseq\n"
  127. " [ % layer color sequence - darkest to lightest\n"
  128. " [0 0 0]\n"
  129. " [.2 .8 .8]\n"
  130. " [.4 .8 .8]\n"
  131. " [.6 .8 .8]\n"
  132. " [.8 .8 .8]\n"
  133. " ]\n"
  134. "def\n"
  135. "\n"
  136. "/layerlen layercolorseq length def\n"
  137. "\n"
  138. "/setlayer {/maxlayer exch def /curlayer exch def\n"
  139. " layercolorseq curlayer 1 sub layerlen mod get\n"
  140. " aload pop sethsbcolor\n"
  141. " /nodecolor {nopcolor} def\n"
  142. " /edgecolor {nopcolor} def\n"
  143. " /graphcolor {nopcolor} def\n"
  144. "} bind def\n"
  145. "\n"
  146. "/onlayer { curlayer ne {invis} if } def\n"
  147. "\n"
  148. "/onlayers {\n"
  149. " /myupper exch def\n"
  150. " /mylower exch def\n"
  151. " curlayer mylower lt\n"
  152. " curlayer myupper gt\n"
  153. " or\n"
  154. " {invis} if\n"
  155. "} def\n"
  156. "\n"
  157. "/curlayer 0 def\n"
  158. "\n"
  159. "%%EndResource\n"
  160. "%%EndProlog\n"
  161. "%%BeginSetup\n"
  162. "14 default-font-family set_font\n"
  163. "% /arrowlength 10 def\n"
  164. "% /arrowwidth 5 def\n"
  165. "\n"
  166. "% make sure pdfmark is harmless for PS-interpreters other than Distiller\n"
  167. "/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse\n"
  168. "% make '<<' and '>>' safe on PS Level 1 devices\n"
  169. "/languagelevel where {pop languagelevel}{1} ifelse\n"
  170. "2 lt {\n"
  171. " userdict (<<) cvn ([) cvn load put\n"
  172. " userdict (>>) cvn ([) cvn load put\n"
  173. "} if\n"
  174. "\n"
  175. "%%EndSetup",
  176. NULL,
  177. // clang-format on
  178. };