| 1 |
lars |
1 |
% $Header: /cvsroot/html2ps/postscript/flow.legend.ps,v 1.1 2005/12/18 07:21:38 Konstantin Exp $
|
|
|
2 |
|
|
|
3 |
% Flow the LEGEND-generated box
|
|
|
4 |
/flow-legend { % => Parent Child
|
|
|
5 |
% calculate size of the legend
|
|
|
6 |
2 copy inline-block-calc-width
|
|
|
7 |
|
|
|
8 |
reflow % => Parent Child
|
|
|
9 |
|
|
|
10 |
% If legend is presend, FIELDSET margin is counted from the LEGEND top edge,
|
|
|
11 |
% not the actual border edge
|
|
|
12 |
% We need to offset the containing FIELDSET by the 1/2 of LEGEND height
|
|
|
13 |
dup get-full-height 2 div
|
|
|
14 |
2 index get-margin-top
|
|
|
15 |
add % => Parent Child NewTopPaddingValue
|
|
|
16 |
2 index get-margin
|
|
|
17 |
exch 0 exch put % => Parent Child NewPaddingArray
|
|
|
18 |
|
|
|
19 |
% If legend is present, FIELDSET padding is counted from the LEGEND bottom edge,
|
|
|
20 |
% not the actual border edge
|
|
|
21 |
dup get-full-height 2 div % => Parent Child (PaddingOffsetValue = H/2)
|
|
|
22 |
2 index get-padding-top
|
|
|
23 |
add % => Parent Child NewTopPaddingValue
|
|
|
24 |
2 index get-padding
|
|
|
25 |
exch 0 exch put % => Parent Child NewPaddingArray
|
|
|
26 |
|
|
|
27 |
% also, note that we'll need to modify current-y, as the flow is already in progress
|
|
|
28 |
1 index get-top-internal
|
|
|
29 |
2 index put-current-y
|
|
|
30 |
|
|
|
31 |
% determine the position of top-left legend box corner
|
|
|
32 |
% X-coordinate
|
|
|
33 |
1 index get-left-padded
|
|
|
34 |
% Y-coordinate
|
|
|
35 |
2 index get-top-padded % => Parent Child X Y
|
|
|
36 |
|
|
|
37 |
2 index
|
|
|
38 |
move-to-box-force % => Parent Child
|
|
|
39 |
|
|
|
40 |
% Do legend offset
|
|
|
41 |
dup % => Parent Child Child
|
|
|
42 |
dup get-full-height % => Parent Child Child H
|
|
|
43 |
2 div % => Parent Child Child H/2
|
|
|
44 |
dup
|
|
|
45 |
offset-box % => Parent Child
|
|
|
46 |
|
|
|
47 |
% clear the stack
|
|
|
48 |
pop pop % =>
|
|
|
49 |
} def
|