chiark / gitweb /
preview png, actually make it a png
[pandemic-rising-tide.git] / cmyk.ps
diff --git a/cmyk.ps b/cmyk.ps
index 18d23fa5f987b55c9c07c7656bcb72f5df032b47..73ecfda27ed6ae408ed30407cf03fb61d7905b6d 100644 (file)
--- a/cmyk.ps
+++ b/cmyk.ps
@@ -1,5 +1,31 @@
 %!
 
+/copyright [
+    (cmyk.{ps,pdf})
+    (v0.1)
+    (Copyright 2019)
+    (Ian Jackson)
+    (GNU AGPL v3+)
+    (NO WARRANTY)
+] def
+
+%    cmyk printer sample test
+%
+%    Copyright (C) 2019 Ian Jackson
+%
+%    This program is free software: you can redistribute it and/or modify
+%    it under the terms of the GNU Affero General Public License as
+%    published by the Free Software Foundation, either version 3 of the
+%    License, or (at your option) any later version.
+%
+%    This program is distributed in the hope that it will be useful,
+%    but WITHOUT ANY WARRANTY; without even the implied warranty of
+%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%    GNU Affero General Public License for more details.
+%
+%    You can obtain a copy of the GNU Affero General Public License
+%    from <http://www.gnu.org/licenses/>.
+
 %    CYM     K
 %
 %    9^3     0 1 2     9 pagex   @   9 x 9 x 3       = 243
 %          horiz M     } M-C-K grid
 %            vert' C   } M-C-K grid
 
-% OLD
-%   16^3 x    0 .. 3       1 Y per page
-%    8^3 x    4 .. 7       4 Y per page      8 = 0 2 4 6 8 10 12 15
-%             8 10 13 15
-
 /debug false def
-/debug true def
+%/debug true def
 
 /paperx 595 def
 /papery 842 def
 
 % o = outer, i = inner, f = final
 
-/margox 5 def
-/margoy 5 def
+/margox 2 def
+/margoy 2 def
 
 /margix 2 def
 /margiy 2 def
 
-/margbx 10 def
-/margby 10 def
+/margby 2 def
 
 % strid = stride
 
 /digits [ (0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
           (a) (b) (c) (d) (e) (f) ] def
 
+/cctexty 8 def
+/ccfont /Helvetica findfont cctexty scalefont def
+
 /Helvetica findfont texty scalefont setfont
 
 /ifdebug { debug exch if } def
 } def 
 
 /cmy_xy2val {
-    maxval gm div mul round cvi
+    maxval gm div  mul  round cvi
+} def
+
+/maxvalshow {
+               (/) show
+               maxval (_) cvs show
 } def
 
 /someyellow {
         szfy setlinewidth
         kentry_x kentry_y translate
 
-               cyany           gn div
-                 magentax      gn div
-                 yellowval     gn div
+               cyany           gm div
+                 magentax      gm div
+                 yellowval     maxval div
                 klist_get maxval div
  { 4 copy } ifdebug
 
@@ -205,10 +233,7 @@ start_page
 /text_magenta {
     (M) show
     magentax cmy_xy2val (_) cvs show
-    magentax gm ge {
-       (/) show
-       maxval (_) cvs show
-    } if
+    magentax gm ge { maxvalshow } if
 } def
 
 /text_l {
@@ -220,6 +245,20 @@ start_page
     } if
     blacky 0 le {
        text_cyan
+       cyany gm 2 sub ge {
+           gsave
+           ccfont setfont
+           cctexty 0.75 mul  texty -0.75 mul  translate
+           90 rotate
+           0 1 1 { /copyrighty exch def
+              0  cctexty copyrighty neg mul  moveto
+              copyright  cyany neg gm add 2 mul  copyrighty add  get
+              dup stringwidth
+              neg exch neg exch  rmoveto
+              show
+           } for
+           grestore
+       } if
     } if
 } def
 /text_u {
@@ -249,18 +288,35 @@ ranges
        magentax 0 le {
            (K) show
            klist blackx get (_) cvs show
+           blackx knx 1 sub eq {
+               maxvalshow
+           } if
            ( ) show
        } if
        blackx 0 le {
            text_magenta
+           magentax gm ge {
+    gsave
+    ( ) show
+    ccfont setfont
+%    stridox gn mul stridoy sub  0 translate
+    %  stridix 0.5 mul -0.25 cctexty mul  0  exch  moveto
+    0 1 1 {
+    ( ) show
+       copyright exch get
+       show
+    } for
+    grestore
+           } if
        } if
     } if
 } def
 /text_ul {
-    text_yellow
 } def
 /text_l {
-    0 texty 0.5 mul rmoveto text_cyan
+    0 texty 0.5 mul translate
+    cyany 0 le { 0 texty moveto text_yellow } if
+    0 0 moveto text_cyan
 } def
 
 /ranges2 {