tcropmarks.ps - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       tcropmarks.ps (3031B)
       ---
            1 %
            2 % Center pages, based on pageheight and pagewidth, and redefine showpage
            3 % to put cropmarks at each corner. Device dependent code to expand the
            4 % paper size goes in procedure expandpagesize. Currently only supports
            5 % a Linotronic 200P typesetter using 12 inch wide paper. You'll have to
            6 % add code to expandpagesize to support different typesetters or even a
            7 % 200P that's running differently.
            8 %
            9 
           10 /CropmarkDict 40 dict dup begin
           11 
           12 /expandpage true def
           13 /magnification 1 def
           14 /pageheight 11.0 def
           15 /pagewidth 8.5 def
           16 /scaletofit false def
           17 /scaling 1 def
           18 
           19 /marklength .3 def        % inches
           20 /markstart .125 def        % inches
           21 /markend .04 def        % inches
           22 /marklinewidth .25 def        % points
           23 
           24 /inch {72 mul} def
           25 /min {2 copy gt {exch} if pop} def
           26 /max {2 copy lt {exch} if pop} def
           27 
           28 /setup {
           29         /markspace markstart marklength add markend add inch marklinewidth add def
           30         /totalheight pageheight inch markspace 2 mul add def
           31         /totalwidth pagewidth inch markspace 2 mul add def
           32 
           33         pagedimensions
           34         checkpagesize
           35         /scaling getscaling def
           36         xcenter ycenter translate
           37         scaling scaling scale
           38         pagewidth inch 2 div neg pageheight inch 2 div neg translate
           39         clippage
           40 } def
           41 
           42 /pagedimensions {
           43         clippath pathbbox newpath
           44         4 -1 roll exch 4 1 roll 4 copy
           45         sub /width exch def
           46         sub /height exch def
           47         add 2 div /xcenter exch def
           48         add 2 div /ycenter exch def
           49 } def
           50 
           51 /checkpagesize {
           52         height totalheight lt width totalwidth lt or expandpage and {
           53                 expandpagesize
           54                 pagedimensions
           55         } if
           56 } def
           57 
           58 /expandpagesize {        % device dependent code
           59         /Product statusdict begin /product where {pop product}{()} ifelse end def
           60 
           61         Product (Linotype) eq {                % Linotronic 200P and other models?
           62                 statusdict /setpageparams known {
           63                         /maxwidth 12.0 inch def                % 12 inch wide paper?
           64                         totalheight maxwidth le {
           65                                 totalheight
           66                                 totalwidth
           67                                 maxwidth totalheight sub 2 div
           68                                 0
           69                         }{
           70                                 totalwidth maxwidth min
           71                                 totalheight
           72                                 maxwidth totalwidth maxwidth min sub 2 div
           73                                 1
           74                         } ifelse
           75                         statusdict /setpageparams get exec
           76                 } if
           77         } if
           78 } def
           79 
           80 /getscaling {
           81         scaletofit
           82                 {height totalheight div width totalwidth div min 1 min}
           83                 {1}
           84         ifelse
           85 } def
           86 
           87 /clippage {
           88         newpath
           89         0 0 moveto
           90         pagewidth inch 0 rlineto
           91         0 pageheight inch rlineto
           92         pagewidth neg inch 0 rlineto
           93         closepath clip
           94         newpath
           95 } def
           96 
           97 /cropmark {
           98         gsave
           99         translate
          100         rotate
          101         marklinewidth dup translate
          102         0 0 transform round exch round exch itransform translate
          103         markstart inch 0 moveto marklength inch 0 rlineto stroke
          104         0 markstart inch moveto 0 marklength inch rlineto stroke
          105         grestore
          106 } bind def
          107 
          108 /@PreviousShowpage /showpage load def
          109 
          110 end def
          111 
          112 %
          113 % Cropmarks - in the default coordinate system.
          114 %
          115 
          116 /showpage {
          117         gsave
          118         CropmarkDict begin
          119                 initgraphics
          120                 marklinewidth setlinewidth
          121                 xcenter ycenter translate
          122                 scaling scaling scale
          123                 0 pagewidth inch 2 div pageheight inch 2 div cropmark
          124                 90 pagewidth inch neg 2 div pageheight inch 2 div cropmark
          125                 180 pagewidth inch neg 2 div pageheight inch 2 div neg cropmark
          126                 270 pagewidth inch 2 div pageheight inch 2 div neg cropmark
          127                 @PreviousShowpage
          128         end
          129         grestore
          130 } bind def
          131