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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
<?xml version="1.0" standalone="no"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN"
"http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-forrest/src/resources/schema/dtd/document-v11.dtd">
<document>
<header>
<title>Area Tree</title>
<subtitle>Area Tree Design for FOP</subtitle>
<authors>
<person name="Keiron Liddle" email="keiron@aftexsw.com"/>
</authors>
</header>
<body>
<p>
The code to implement the area tree matches the areas
defined in the specification. This makes it easier to understand and
correspond with the specification.
</p>
<p>
The area tree is created by the layout managers once the layout is decided
for a page. Once a completed page is finished it can then be added to the
area tree. The area tree model can then handle the new page. The data in
the area tree must be minimal and independant. This means that the data
uses less memory and can be serialized to an output stream if needed.
</p>
<section>
<title>Structure</title>
<p>
The area tree is a root element that has a list of page-viewport-areas.
Each page viewport has a page-reference-area which holds the contents of
the page. To handle the processing better FOP does not maintain a list
at the root level but lets the area tree model handle each page as it is added.
</p>
</section>
<section>
<title>Page</title>
<p>
A page is made up of five area regions. These are before, start, body,
end and after. Each region has a viewport and contains the areas
produced from the children in the FO object heirarchy.
</p>
<p>
For the body area there are more subdivisions for before floats,
footnotes and the main reference area. The main reference area is
made from span areas which have normal flow reference areas as
children. The flow areas are then created inside these normal flow
reference areas.
</p>
<p>
Since the layout is done inside a page, the page is created from the
pagemaster with all the appropriate areas. The layout manager then
uses the page to add areas into the normal flow reference areas
and floats and footnotes. After adding the areas for the body region
then the other regions can be done layed out and added.
</p>
</section>
<section>
<title>Block Areas</title>
<p>
Block areas are created and/or returned by all top level elements
in the flow. The spacing between block areas is handled by an
empty block area. A block area is stacked with other block
areas in a particular direction, it has a size and it contains
line areas made from a group of inline areas and/or block areas.
</p>
</section>
<section>
<title>Line Areas</title>
<p>
A line areas is simply a collection of inline areas that are stacked
in the inline progression direction. A line area has a height and
a start position. The line area is rendered by handling each inline
area.
</p>
<p>
A line area gets a set of inline areas added until complete then
it is justified and vertically alignedi when adding the areas.
If the line area contains unresolved areas then there will
be a line resolver that retains the justification information until
all areas in the line are resolved.
</p>
</section>
<section>
<title>Inline Areas</title>
<p>
There are a few different types of inline areas. All inline areas
have a height and width.
</p>
<p>
Unresolved areas can reserve some space to allow for possible
sizes once it is resolved. Then the line can be re-justified
and finalised.
</p>
</section>
<section>
<title>Repeated Areas</title>
<p>
There are cases where the same subtree could be repeated in the area
tree. These areas will be returned by the same layout managers.
So it is possible to put a flag on the created areas so that
the subtree data can be cached in the output. Examples of this are:
static areas, table header/footer, svg.
</p>
</section>
<section>
<title>Classes</title>
<p>
The following class structure will be used to represent the area
tree.
</p>
<section>
<title>Page Area Classes</title>
<p>
The page area classes hold the top level layout of a page. The
areas are created by the page master and should be ready to have
flow areas added.
</p>
</section>
<section>
<title>Block Area Classes</title>
<p>
The block areas hold other block areas and/or line areas. The
child areas are stacked in a particular direction.
</p>
<p>
Areas for tables, lists and block container have their child
block areas stacked in different ways. These areas a placed
with an absolute positioning. The absolute positioning is where
the blocks are placed with an offset from the parent reference area.
</p>
</section>
<section>
<title>Inline Area Classes</title>
<p>
The inline areas are used to make up a line area. An inline area
typically has a height, width and some content. The inline area
is offset from the baseline of the current line area. The content
of the inline area can be other inline areas or a simple atomic
object.
</p>
</section>
</section>
<section>
<title>Rendering Area Tree</title>
<p>
The rendering of an area tree is done by rendering each page
to a suitable output. The regions are rendered in order and each
region is contained by a viewport.
</p>
<p>
The relevent structures that will need to be rendered are:
Page
Viewport
Region
Span
Block
Line
Inline
</p>
<p>
A renderer implementation does the following:
</p>
<ul>
<li>render each individual page</li>
<li>clip and align child areas to a viewport</li>
<li>handle all types of inline area, text, image etc.</li>
<li>draw various lines and rectangles</li>
</ul>
<p>
An abstract renderer will be able to handle the generic positioning
of child areas, iterating through areas that have child areas.
</p>
</section>
</body>
</document>
|