| 1 |
lars |
1 |
% $Header: /cvsroot/html2ps/postscript/flow.inline.ps,v 1.1 2005/12/18 07:21:38 Konstantin Exp $
|
|
|
2 |
|
|
|
3 |
% Check if given point is inside some alredy-layout floating box
|
|
|
4 |
/maybe-line-break-1 { % => Parent Child
|
|
|
5 |
% Check for right-floating boxes
|
|
|
6 |
% If upper-right corner of this inline box is inside of some float, wrap the line
|
|
|
7 |
context-floats % => Parent Child Floats
|
|
|
8 |
1 index get-full-width
|
|
|
9 |
3 index get-current-x add % => Parent Child Floats X
|
|
|
10 |
3 index get-current-y % => Parent Child Floats X Y
|
|
|
11 |
point-in-floats % => Parent Child Float/false
|
|
|
12 |
false ne % => Parent Chils true/false
|
|
|
13 |
exch pop
|
|
|
14 |
exch pop
|
|
|
15 |
} def % => true/false
|
|
|
16 |
|
|
|
17 |
/maybe-line-break-2 { % => Parent Child
|
|
|
18 |
dup get-full-width
|
|
|
19 |
2 index get-current-x add % => Parent Child X
|
|
|
20 |
|
|
|
21 |
2 index get-right-internal
|
|
|
22 |
rounding-epsilon add % => Parent Child X R
|
|
|
23 |
|
|
|
24 |
3 index get-current-x % => Parent Child X R CX
|
|
|
25 |
4 index get-left-internal % => Parent Child X R CX Left
|
|
|
26 |
|
|
|
27 |
gt 3 1 roll gt and % => Parent Child (X>R)&&(CX>Left)
|
|
|
28 |
|
|
|
29 |
exch pop
|
|
|
30 |
exch pop % => true/false
|
|
|
31 |
} def
|
|
|
32 |
|
|
|
33 |
/maybe-line-break-in { % => Parent Child
|
|
|
34 |
2 copy maybe-line-break-1 {
|
|
|
35 |
pop pop true
|
|
|
36 |
} {
|
|
|
37 |
2 copy maybe-line-break-2 {
|
|
|
38 |
pop pop true
|
|
|
39 |
} {
|
|
|
40 |
pop pop false
|
|
|
41 |
} ifelse
|
|
|
42 |
} ifelse
|
|
|
43 |
} def
|
|
|
44 |
|
|
|
45 |
/maybe-line-break { % => Parent Child
|
|
|
46 |
2 copy maybe-line-break-in dup { % => Parent Child Break
|
|
|
47 |
% break is needed
|
|
|
48 |
% check if parent line box containg any boxes
|
|
|
49 |
2 index get-line length 0 eq {
|
|
|
50 |
1 index get-height
|
|
|
51 |
3 index get-current-y
|
|
|
52 |
exch sub % => Parent Child Break CY'
|
|
|
53 |
3 index put-current-y
|
|
|
54 |
} if % => Parent Child Break
|
|
|
55 |
|
|
|
56 |
2 index close-line
|
|
|
57 |
} if % => Parent Child Break
|
|
|
58 |
|
|
|
59 |
exch pop
|
|
|
60 |
exch pop % => Break
|
|
|
61 |
} def
|
|
|
62 |
|
|
|
63 |
/line-break-allowed { % => Box
|
|
|
64 |
dup get-box-dict /Display get
|
|
|
65 |
dup /-text ne
|
|
|
66 |
exch pop
|
|
|
67 |
exch pop
|
|
|
68 |
} def % => true/false
|
|
|
69 |
|
|
|
70 |
/flow-inline { % => Parent Child
|
|
|
71 |
1 index line-break-allowed {
|
|
|
72 |
{
|
|
|
73 |
2 copy maybe-line-break not
|
|
|
74 |
{ exit } if
|
|
|
75 |
} loop
|
|
|
76 |
} if
|
|
|
77 |
|
|
|
78 |
% set default baseline
|
|
|
79 |
dup get-default-baseline
|
|
|
80 |
1 index put-baseline
|
|
|
81 |
|
|
|
82 |
% Determine the baseline position and height of the text-box using line-height CSS property
|
|
|
83 |
dup get-box-dict
|
|
|
84 |
/Display get
|
|
|
85 |
/inline-text eq {
|
|
|
86 |
apply-line-height
|
|
|
87 |
} if
|
|
|
88 |
|
|
|
89 |
dup get-vertical-align exec
|
|
|
90 |
|
|
|
91 |
dup 2 index append-line
|
|
|
92 |
|
|
|
93 |
% Determine coordinates of upper-left corner
|
|
|
94 |
1 index get-current-x
|
|
|
95 |
2 index get-current-y % => Parent Child X Y
|
|
|
96 |
2 index
|
|
|
97 |
move-to-box % => Parent Child
|
|
|
98 |
|
|
|
99 |
% ???
|
|
|
100 |
dup
|
|
|
101 |
|
|
|
102 |
offset-box
|
|
|
103 |
|
|
|
104 |
% Offset parent current X value
|
|
|
105 |
1 index get-current-x % => Parent Child PCX
|
|
|
106 |
1 index get-full-width % => Parent Child PCX CW
|
|
|
107 |
add % => Parent Child PCX+CW
|
|
|
108 |
2 index put-current-x % => Parent Child
|
|
|
109 |
|
|
|
110 |
% extend parent's height
|
|
|
111 |
dup get-full-height
|
|
|
112 |
exch pop
|
|
|
113 |
extend-height % => Parent
|
|
|
114 |
|
|
|
115 |
pop
|
|
|
116 |
} def
|