| 1 |
lars |
1 |
% $Header: /cvsroot/html2ps/postscript/footer.ps,v 1.1 2005/12/18 07:21:38 Konstantin Exp $
|
|
|
2 |
|
|
|
3 |
% As BODY generated box have zero calculated width at the very moment,
|
|
|
4 |
% and we need some box to use as a parameter to _calc_percentage_margins,
|
|
|
5 |
% we'll create a fake box having with equal to the viewport width.
|
|
|
6 |
|
|
|
7 |
% => BODY
|
|
|
8 |
dup /pre-reflow-images
|
|
|
9 |
call-method % => BODY
|
|
|
10 |
|
|
|
11 |
box-block-create % => BODY MediaBox
|
|
|
12 |
pagewidth
|
|
|
13 |
lmargin sub
|
|
|
14 |
rmargin sub % => BODY MediaBox PW
|
|
|
15 |
1 index put-width % => BODY MediaBox
|
|
|
16 |
|
|
|
17 |
% Calculate actual margin values
|
|
|
18 |
1 index box-generic-calc-percentage-margins
|
|
|
19 |
% => BODY
|
|
|
20 |
|
|
|
21 |
pagewidth
|
|
|
22 |
lmargin sub
|
|
|
23 |
rmargin sub
|
|
|
24 |
1 index get-hor-extra sub
|
|
|
25 |
1 index put-width % => BODY
|
|
|
26 |
|
|
|
27 |
pageheight
|
|
|
28 |
tmargin sub
|
|
|
29 |
bmargin sub
|
|
|
30 |
1 index get-vert-extra sub
|
|
|
31 |
1 index put-height
|
|
|
32 |
|
|
|
33 |
pageheight tmargin sub
|
|
|
34 |
1 index get-extra-top sub
|
|
|
35 |
1 index put-top
|
|
|
36 |
|
|
|
37 |
lmargin
|
|
|
38 |
1 index get-extra-left add
|
|
|
39 |
1 index put-left
|
|
|
40 |
|
|
|
41 |
% create the initial context
|
|
|
42 |
% => Box
|
|
|
43 |
context-create % => Box Context
|
|
|
44 |
1 index flow-viewport-create % => Box Context Viewport
|
|
|
45 |
1 index context-push-viewport % => Box Context
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
exch 1 index % => Context Box Context
|
|
|
49 |
/null % => Context Box Context FakeParent
|
|
|
50 |
2 index /reflow call-method % => Context Box
|
|
|
51 |
dup /reflow-inline call-method
|
|
|
52 |
|
|
|
53 |
% flow absolute-positioned boxes
|
|
|
54 |
1 index
|
|
|
55 |
context-get-absolute-positioned {% => Context Box AbsoluteBox
|
|
|
56 |
2 index context-push
|
|
|
57 |
|
|
|
58 |
2 index exch
|
|
|
59 |
/reflow-absolute call-method
|
|
|
60 |
|
|
|
61 |
1 index context-pop
|
|
|
62 |
} forall
|
|
|
63 |
|
|
|
64 |
% flow fixed-positioned boxes
|
|
|
65 |
1 index
|
|
|
66 |
context-get-fixed-positioned {% => Context Box AbsoluteBox
|
|
|
67 |
2 index context-push
|
|
|
68 |
|
|
|
69 |
2 index exch
|
|
|
70 |
box-block-reflow-fixed
|
|
|
71 |
|
|
|
72 |
1 index context-pop
|
|
|
73 |
} forall
|
|
|
74 |
|
|
|
75 |
% Make the top-level box competely fill the last page
|
|
|
76 |
/pages 1 index get-full-height real-page-height div ceiling 1 max def
|
|
|
77 |
|
|
|
78 |
% Note we cannot have less than 1 page in our doc; max() call
|
|
|
79 |
% is required as we, in general, CAN have the content height strictly equal to 0.
|
|
|
80 |
% In this case wi still render the very first page
|
|
|
81 |
|
|
|
82 |
pages real-page-height mul
|
|
|
83 |
1 index get-top
|
|
|
84 |
pageheight tmargin sub
|
|
|
85 |
sub
|
|
|
86 |
add % => Context Box H
|
|
|
87 |
dup 2 index put-height % => Context Box H
|
|
|
88 |
1 index get-content 0 get put-height
|
|
|
89 |
|
|
|
90 |
dup viewport-create % => Context Box Viewport
|
|
|
91 |
|
|
|
92 |
% generate a list of anchors
|
|
|
93 |
<< >> % => Context Box Viewport List
|
|
|
94 |
dup
|
|
|
95 |
2 index % => Context Box Viewport List List Viewport
|
|
|
96 |
4 index % => Context Box Viewport List List Viewport Box
|
|
|
97 |
/reflow-anchors
|
|
|
98 |
call-method % => Context Box Viewport Anchors
|
|
|
99 |
|
|
|
100 |
1 index viewport-put-anchors % => Context Box Viewport
|
|
|
101 |
exch % => Context Viewport Box
|
|
|
102 |
1 index /page-offset bmargin put
|
|
|
103 |
1 index /height real-page-height put
|
|
|
104 |
|
|
|
105 |
1 1 pages { % => Context Viewport Box I
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
2 index viewport-init-page
|
|
|
109 |
|
|
|
110 |
gsave
|
|
|
111 |
2 index viewport-setup-clip
|
|
|
112 |
|
|
|
113 |
2 index % => Context Viewport Box I Viewport
|
|
|
114 |
2 index /show call-method % => Context Viewport Box I
|
|
|
115 |
|
|
|
116 |
% Absolute positioned boxes should be shown after all other boxes, because
|
|
|
117 |
% they're placed higher in the stack-order
|
|
|
118 |
3 index
|
|
|
119 |
context-get-absolute-positioned {
|
|
|
120 |
% => Context Viewport Box I AbsoluteBox
|
|
|
121 |
dup /visibility get-css-value /visible eq {
|
|
|
122 |
3 index % => Context Viewport Box I AbsoluteBox Viewport
|
|
|
123 |
1 index % => Context Viewport Box I AbsoluteBox ViewportAbsoluteBox
|
|
|
124 |
/show call-method % => Context Viewport Box I AbsoluteBox
|
|
|
125 |
} if
|
|
|
126 |
|
|
|
127 |
pop
|
|
|
128 |
} forall % => Context Viewport Box I
|
|
|
129 |
|
|
|
130 |
grestore
|
|
|
131 |
|
|
|
132 |
3 index
|
|
|
133 |
context-get-fixed-positioned {
|
|
|
134 |
% => Context Viewport Box I AbsoluteBox
|
|
|
135 |
dup /visibility get-css-value /visible eq {
|
|
|
136 |
3 index % => Context Viewport Box I AbsoluteBox Viewport
|
|
|
137 |
1 index % => Context Viewport Box I AbsoluteBox ViewportAbsoluteBox
|
|
|
138 |
box-block-show-fixed
|
|
|
139 |
} if
|
|
|
140 |
|
|
|
141 |
pop
|
|
|
142 |
} forall % => Context Viewport Box I
|
|
|
143 |
|
|
|
144 |
setting-draw-page-border {
|
|
|
145 |
2 index viewport-draw-page-border
|
|
|
146 |
} if
|
|
|
147 |
|
|
|
148 |
% Add page if currently rendered page is not last
|
|
|
149 |
2 index viewport-next-page
|
|
|
150 |
|
|
|
151 |
showpage
|
|
|
152 |
pop
|
|
|
153 |
initpage
|
|
|
154 |
} for
|