50 lines
1.7 KiB
PostScript
50 lines
1.7 KiB
PostScript
% $Header: /cvsroot/html2ps/postscript/flow.legend.ps,v 1.1 2005/12/18 07:21:38 Konstantin Exp $
|
|
|
|
% Flow the LEGEND-generated box
|
|
/flow-legend { % => Parent Child
|
|
% calculate size of the legend
|
|
2 copy inline-block-calc-width
|
|
|
|
reflow % => Parent Child
|
|
|
|
% If legend is presend, FIELDSET margin is counted from the LEGEND top edge,
|
|
% not the actual border edge
|
|
% We need to offset the containing FIELDSET by the 1/2 of LEGEND height
|
|
dup get-full-height 2 div
|
|
2 index get-margin-top
|
|
add % => Parent Child NewTopPaddingValue
|
|
2 index get-margin
|
|
exch 0 exch put % => Parent Child NewPaddingArray
|
|
|
|
% If legend is present, FIELDSET padding is counted from the LEGEND bottom edge,
|
|
% not the actual border edge
|
|
dup get-full-height 2 div % => Parent Child (PaddingOffsetValue = H/2)
|
|
2 index get-padding-top
|
|
add % => Parent Child NewTopPaddingValue
|
|
2 index get-padding
|
|
exch 0 exch put % => Parent Child NewPaddingArray
|
|
|
|
% also, note that we'll need to modify current-y, as the flow is already in progress
|
|
1 index get-top-internal
|
|
2 index put-current-y
|
|
|
|
% determine the position of top-left legend box corner
|
|
% X-coordinate
|
|
1 index get-left-padded
|
|
% Y-coordinate
|
|
2 index get-top-padded % => Parent Child X Y
|
|
|
|
2 index
|
|
move-to-box-force % => Parent Child
|
|
|
|
% Do legend offset
|
|
dup % => Parent Child Child
|
|
dup get-full-height % => Parent Child Child H
|
|
2 div % => Parent Child Child H/2
|
|
dup
|
|
offset-box % => Parent Child
|
|
|
|
% clear the stack
|
|
pop pop % =>
|
|
} def
|