chiark / gitweb /
wip text etc.
[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 /klist_get {
38     klist
39         blackx
40         blacky  knx mul add
41         get
42 } def
43 /kentry_moveto {
44                 blackx                          stridix mul
45                  blacky  neg kmy add            stridiy mul
46                  szfy +0.5 mul add
47 } def
48
49 /someyellow {
50     
51     /gn     gm    1 add   def
52     /kmx    knx   1 sub   def
53     /kmy    kny   1 sub   def
54
55     /stridox  gridox  gn  div  def
56     /stridoy  gridoy  gn  div  def
57
58     /szix  stridox  margox sub  def
59     /sziy  stridoy  margoy sub  def
60
61     /stridix  szix  knx  div def
62     /stridiy  sziy  kny  div def
63
64     /szfx  stridix  margix sub  def
65     /szfy  stridiy  margiy sub  def
66
67     0 1 gm {            /magenta exch def
68     0 1 gm {            /cyan    exch def
69
70     gsave
71         textx  0      translate
72
73         magenta                 stridox mul
74         cyan    neg gm add      stridoy mul  translate
75
76         szfy setlinewidth
77  
78         0 1 kmx {       /blackx exch def
79         0 1 kmy {       /blacky exch def
80
81                 cyan            gn div
82                  magenta        gn div
83                  yellow         gn div
84
85                 klist_get base div
86
87                  setcmykcolor
88
89                 kentry_moveto moveto
90
91                 szfx 0 rlineto stroke
92
93         } for
94         } for
95
96     grestore
97
98     } for
99     } for
100
101 } def
102
103 /ranges {
104
105     0 1 gm {                    /yellow  exch def
106         someyellow
107
108     0 setgray
109     /Helvetica findfont 18 scalefont setfont
110     0 0 moveto
111     (Y) show
112     yellow (___) cvs show
113
114     finish_page
115     } for
116
117 } def
118
119 /start_page {
120     margin margin translate
121 } def
122 start_page
123
124 /finish_page {
125     0 setgray
126     /Helvetica findfont texty scalefont setfont
127     gsave
128
129     0  printareay texty sub translate
130
131     0 0 moveto  (K) show
132
133     gsave
134       0  stridoy neg  translate
135       
136       0 1 kmx { /blackx exch def
137       0 1 kmy { /blacky exch def
138         kentry_moveto exch 0.65 mul exch moveto
139         klist_get digits exch get
140         show
141       } for
142       } for
143     grestore
144     grestore
145
146     showpage
147     start_page
148 } def
149
150 /base 16 def
151
152 /gm 16 def
153
154 /knx 2 def
155 /kny 2 def
156
157 /klist [ 0 1 2 3 ] def
158 /ylist [ 0 1 2 3 5 8 11 15 ] def
159
160 /gridox szox def
161 /gridoy szoy def
162
163 %ranges
164
165 /ranges2 {
166
167 /gm 8 def
168
169 /gridox szox 2 div margbx sub def
170 /gridoy szoy 2 div margby sub def
171
172 0 1 1 { /yellowpage exch def
173 0 1 1 { /yellowx exch def
174 0 1 1 { /yellowy exch def
175
176 /yellowix
177   yellowpage            4 mul
178   yellowy    neg 1 add  2 mul add
179   yellowx                     add def
180
181 gsave
182  yellowx  gridox margbx add  mul
183  yellowy  gridoy margby add  mul
184  translate
185
186  /yellow  ylist yellowix get  def
187
188  someyellow
189 grestore
190
191 } for
192 } for
193 finish_page
194 } for
195
196 } def
197
198 /klist [ 4 5 6 7 ] def   ranges2
199 /klist [ 8 10 13 15 ] def ranges2