chiark / gitweb /
wip text
[pandemic-rising-tide.git] / cmyk.ps
1 %!
2
3 %   16^3 x    0 .. 3       1 Y per page
4 %    8^3 x    4 .. 7       4 Y per page      8 = 0 2 4 6 8 10 12 15
5 %             8 10 13 15
6
7 /paperx 595 def
8 /papery 842 def
9
10 /margin 18 def
11
12 /printareax paperx margin 2 mul sub def
13 /printareay papery margin 2 mul sub def
14
15 /textx 20 def
16 /texty 12 def
17
18 /szox printareax textx sub def
19 /szoy printareay texty sub def
20
21 % o = outer, i = inner, f = final
22
23 /margox 5 def
24 /margoy 5 def
25
26 /margix 2 def
27 /margiy 2 def
28
29 /margbx 10 def
30 /margby 10 def
31
32 % strid = stride
33
34 /digits [ (0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
35           (a) (b) (c) (d) (e) (f) ] def
36
37 /Helvetica findfont texty scalefont setfont
38
39 /klist_get {
40     klist
41         blackx
42         blacky  knx mul add
43         get
44 } def
45 /kentry_moveto {
46                 blackx                          stridix mul
47                  blacky  neg kmy add            stridiy mul
48                  szfy +0.5 mul add
49 } def
50
51 /someyellow {
52     
53     /gn     gm    1 add   def
54     /kmx    knx   1 sub   def
55     /kmy    kny   1 sub   def
56
57     /stridox  gridox  gn  div  def
58     /stridoy  gridoy  gn  div  def
59
60     /szix  stridox  margox sub  def
61     /sziy  stridoy  margoy sub  def
62
63     /stridix  szix  knx  div def
64     /stridiy  sziy  kny  div def
65
66     /szfx  stridix  margix sub  def
67     /szfy  stridiy  margiy sub  def
68
69     0 1 gm {            /magenta exch def
70     0 1 gm {            /cyan    exch def
71
72     gsave
73         textx  0      translate
74
75         magenta                 stridox mul
76         cyan    neg gm add      stridoy mul  translate
77
78         szfy setlinewidth
79  
80         0 1 kmx {       /blackx exch def
81         0 1 kmy {       /blacky exch def
82
83                 cyan            gn div
84                  magenta        gn div
85                  yellow         gn div
86
87                 klist_get base div
88
89                  setcmykcolor
90
91                 kentry_moveto moveto
92
93                 szfx 0 rlineto stroke
94
95         } for
96         } for
97
98     grestore
99     } for
100     } for
101
102     gsave
103
104       0  gridoy translate
105
106       text_l_p text_u_p and {
107         gsave
108           0 0 moveto  (K) show
109
110         gsave
111           0  stridoy neg  translate
112
113           0 1 kmx {     /blackx exch def
114           0 1 kmy {     /blacky exch def
115             kentry_moveto exch 0.65 mul exch moveto
116             klist_get digits exch get
117             show
118           } for
119           } for
120         grestore
121         grestore
122       } if
123
124     grestore
125
126 } def
127
128 /ranges {
129
130     0 1 gm {                    /yellow  exch def
131         someyellow
132
133     0 setgray
134     0 0 moveto
135     (Y) show
136     yellow (___) cvs show
137
138     finish_page
139     } for
140
141 } def
142
143 /start_page {
144     margin margin translate
145 } def
146 start_page
147
148 /finish_page {
149     0 setgray
150
151     showpage
152     start_page
153 } def
154
155 /base 16 def
156
157 /gm 16 def
158
159 /knx 2 def
160 /kny 2 def
161
162 /klist [ 0 1 2 3 ] def
163 /ylist [ 0 1 2 3 5 8 11 15 ] def
164
165 /gridox szox def
166 /gridoy szoy def
167
168 /text_l_p true def
169 /text_u_p true def
170
171 ranges
172
173 /ranges2 {
174
175 /gm 8 def
176
177 /gridox szox 2 div margbx sub def
178 /gridoy szoy 2 div margby sub def
179
180 0 1 1 { /yellowpage exch def
181 0 1 1 { /yellowx exch def
182 0 1 1 { /yellowy exch def
183
184 /yellowix
185   yellowpage            4 mul
186   yellowy    neg 1 add  2 mul add
187   yellowx                     add def
188
189 gsave
190  yellowx  gridox margbx add  mul
191  yellowy  gridoy margby add  mul
192  translate
193
194  /yellow  ylist yellowix get  def
195
196  /text_l_p  yellowx 0 le  def
197  /text_u_p  yellowy 1 ge  def
198
199  someyellow
200 grestore
201
202 } for
203 } for
204 finish_page
205 } for
206
207 } def
208
209 /klist [ 4 5 6 7 ] def   ranges2
210 /klist [ 8 10 13 15 ] def ranges2