aboutsummaryrefslogtreecommitdiff
path: root/postscript/prologues/cropmarks.ps
blob: 256891a9a248078f19fa4fa594013bfca85422e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
%
% Center pages, based on pageheight and pagewidth, and redefine showpage
% to put cropmarks at each corner. Device dependent code to expand the
% paper size goes in procedure expandpagesize. Currently only supports
% a Linotronic 200P typesetter using 12 inch wide paper. You'll have to
% add code to expandpagesize to support different typesetters or even a
% 200P that's running differently.
%

/CropmarkDict 40 dict dup begin

/expandpage true def
/magnification 1 def
/pageheight 11.0 def
/pagewidth 8.5 def
/scaletofit false def
/scaling 1 def

/marklength .3 def	% inches
/markstart .125 def	% inches
/markend .04 def	% inches
/marklinewidth .25 def	% points

/inch {72 mul} def
/min {2 copy gt {exch} if pop} def
/max {2 copy lt {exch} if pop} def

/setup {
	/markspace markstart marklength add markend add inch marklinewidth add def
	/totalheight pageheight inch markspace 2 mul add def
	/totalwidth pagewidth inch markspace 2 mul add def

	pagedimensions
	checkpagesize
	/scaling getscaling def
	xcenter ycenter translate
	scaling scaling scale
	pagewidth inch 2 div neg pageheight inch 2 div neg translate
	clippage
} def

/pagedimensions {
	clippath pathbbox newpath
	4 -1 roll exch 4 1 roll 4 copy
	sub /width exch def
	sub /height exch def
	add 2 div /xcenter exch def
	add 2 div /ycenter exch def
} def

/checkpagesize {
	height totalheight lt width totalwidth lt or expandpage and {
		expandpagesize
		pagedimensions
	} if
} def

/expandpagesize {	% device dependent code
	/Product statusdict begin /product where {pop product}{()} ifelse end def

	Product (Linotype) eq {		% Linotronic 200P and other models?
		statusdict /setpageparams known {
			/maxwidth 12.0 inch def		% 12 inch wide paper?
			totalheight maxwidth le {
				totalheight
				totalwidth
				maxwidth totalheight sub 2 div
				0
			}{
				totalwidth maxwidth min
				totalheight
				maxwidth totalwidth maxwidth min sub 2 div
				1
			} ifelse
			statusdict /setpageparams get exec
		} if
	} if
} def

/getscaling {
	scaletofit
		{height totalheight div width totalwidth div min 1 min}
		{1}
	ifelse
} def

/clippage {
	newpath
	0 0 moveto
	pagewidth inch 0 rlineto
	0 pageheight inch rlineto
	pagewidth neg inch 0 rlineto
	closepath clip
	newpath
} def

/cropmark {
	gsave
	translate
	rotate
	marklinewidth dup translate
	0 0 transform round exch round exch itransform translate
	markstart inch 0 moveto marklength inch 0 rlineto stroke
	0 markstart inch moveto 0 marklength inch rlineto stroke
	grestore
} bind def

/@PreviousShowpage /showpage load def

end def

%
% Cropmarks - in the default coordinate system.
%

/showpage {
	gsave
	CropmarkDict begin
		initgraphics
		marklinewidth setlinewidth
		xcenter ycenter translate
		scaling scaling scale
		0 pagewidth inch 2 div pageheight inch 2 div cropmark
		90 pagewidth inch neg 2 div pageheight inch 2 div cropmark
		180 pagewidth inch neg 2 div pageheight inch 2 div neg cropmark
		270 pagewidth inch 2 div pageheight inch 2 div neg cropmark
		@PreviousShowpage
	end
	grestore
} bind def