4.1.1 Geometric rendered areas The result of formatting is the generation of geometric areas for rendering based upon an area model which: -
is a superset of CSS2 box formatting model, -
includes references to areas by other areas, -
defines relationships and space adjustment between areas generated for letters , words, lines, and blocks. Areas are arranged hierarchically as a result of interpreting formatting objects. -
Each branch of the tree collects areas that are related . -
Each area has a relative or absolute position described by a spacing constraint. -
Each area may have content to display. -
Each area may have visual or aural presentations different from those of other areas. -
Areas define placement of every glyph, shape, and image with spacing constraints. Not all kinds of areas can be directly specified by the XSL-FO instance. -
For example, lines in a block are areas synthesized only by the formatter during the flowing of information. -
Objects and properties in the XSL-FO instance can influence the presentation of the synthesized areas; -
e.g., initial-property-set object influences the first generated line of a block; -
e.g., line-height property governs how much of a block is taken up by each of the lines. A paginated area and static areas can be defined for each page. -
Paginated areas accept content to be flowed and trigger the generation of as many pages as needed to fit the flow of information to be rendered; -
Static areas are rendered on every page that is generated by pagination; -
A page's geometry need not contain any region that is accepting flow; A single object can create many areas. -
Not all generated areas of a given sequence need be adjacent, nor hierarchically related to each other. -
The name of the formatting object that produces the desired areas is not important. The hierarchical area tree has familial relationships between nodes of the tree; -
a node can be child, sibling, parent, descendant, ancestor , or root; -
a set of nodes are ordered within the parent; -
there is only one order of sibling nodes; -
this ordering defines initial, preceding , following, and final relationships; -
there are two traversals of the tree when dealing with child nodes of the parent; -
pre-order traversal orders the parent before the children, e.g.: -
determining the "next" area for keep-with-next , -
determining preference in markers for retrieve-marker ; -
post-order traversal orders the parent after the children, e.g.: -
neither traversal order changes the order of the children themselves . The root node is not an area. The area tree can have very many areas described. -
Even every glyph (character shape) has its own area. -
Every area has its own placement direction and spacing constraint. -
There is no obligation on the formatter to serialize or externalize the area tree. Most nodes generate a singular area. The formatter has sufficient information in the finalized areas to effect the rendering. 4.1.2 Directions and writing modes Orientations and directions are defined for a reference area. -
Every reference area has an orientation with respect the definition of the "top" of the area and its writing direction. -
Descendent reference areas can have orientations modified relative to the containing reference area. -
Descendent areas that are not reference areas cannot have their orientations changed. Reference areas are found in many places in the area tree, including -
region reference area (perimeter regions ), -
main reference area (page bodies), -
before-float reference area (before floats), -
footnote reference area (footnotes), -
span reference area ( spanned columns ), -
normal-flow reference area (columns), -
lines in a block, -
title , -
block-container and inline-container , -
table , table-caption , and table- cell . Stacking rules govern how adjacent areas created by objects in flow are related along directions. -
All objects are defined as stacking in a particular direction relative to their adjacent objects or other objects. -
Some objects are "out of line" in the stacking order; -
General rules of thumb with powerful nuances are available for specific requirements. Various directions govern the placement of objects relative to their siblings. Writing-mode-related properties reflect cultural practices of flowing information on a page, as shown in Figure 4-3. -
For example, an indent at the start of a line in a left-to-right writing mode is on the opposite side of the page compared to the indent at the start of a line in a right-to-left writing mode. -
Before, after, start, and end edges of each writing mode are relative to the reference orientation that defines the top edge of the area. Figure 4-3. Possible writing modes Two properties govern progression direction of adjacent areas on the page. -
reference-orientation : -
defines the direction of the top edge of a reference area relative to containing reference area, -
can be positive (counter-clockwise) or negative, in multiples of 90 degrees. -
writing-mode : -
specifies the inline-progression direction and the block-progression direction, in the form of two-letter codes separated by a hyphen, relative to the top of the reference area, -
can be lr-tb or lr meaning left-to-right for inline, top-to-bottom for block, e.g.: -
can be rl-tb or rl meaning right-to-left for inline, top-to-bottom for block, e.g.: -
can be tb-lr or tb meaning left-to-right for inline, top-to-bottom for block, e.g.: -
A combination of these properties can be used on other objects to define other direction-related traits, e.g.: -
placement and orientation of perimeter regions within pages, -
placement of columns within body region, -
placement and orientation of rows and columns within tables, -
changes within paginated content and static content in a region, e.g.: -
by using block-container objects at the block level, -
by using inline-container objects at the inline level. -
These properties can only be specified for reference areas. Bidirectional writing is inherently supported by XSL-FO processors. -
One of the most powerful features of XSL-FO is that the stylesheet writer need not be aware of the writing direction of the characters used in the XML documents being formatted; -
The formatter automatically accommodates bidirectional writing based upon the inherent properties of the Unicode characters in the content. -
bidi-override object is only used when direction inferred by the Unicode character is not as desired. 4.1.3 Margins, spaces, and positioning Areas are positioned by specifying the spaces around them. -
Areas that are flowed adjacent to each other are separated by their spacing specifications. -
Floats and footnotes are positioned out-of-line as defined by the Recommendation. -
Only a block-container can be positioned arbitrarily on the page. -
This is indicated by using absolute-position which implies -
either a relative distance from its siblings, -
or an absolute distance from an ancestor, in particular: -
Distances from ancestral area edges are specified using top , bottom , left , or right . Spaces and non-page margins define the same values, but from different perspectives. Page margins Discarding space 4.1.4 Lengths and spacing Lengths can be specified in both absolute and relative terms. -
cm is centimeter; -
mm is millimeter; -
in is inch = 2.54 cm; -
pt is point = 1/72 in; -
pc is pica = 12 pt = 1/6 in; -
px is pixel = 1 device dot (nominally 1/90 " or .28 mm); -
em is the current font size (the only relative unit of measure); -
Note that there is no "ex" measurement. -
Sometimes it is used in formatting specifications as the height of a lowercase letter in the current font size. -
This is not a concept that is easily interpreted in all international character repertoires . -
It is used in XSL-FO in the definition of one of the baselines for those scripts that have an ex value. Spaces are used to position areas within other areas and can be influenced by -
specifying minimum, maximum, and optimum; -
specifying conditionality ; -
specifying precedence; -
interaction of adjacent siblings' space specifications; Some properties can be specified using a percentage. -
When inherited, percentages are relative to their inherited value, e.g.: -
When not inherited, percentages are relative to a reference rectangle; -
for XSL-defined properties, this is the content rectangle; -
for CSS-defined properties, this is closest non-line-area content rectangle; -
exceptions exist for out-of-line constructs and the regions in which they are used (detailed in Recommendation, Section 7.3). 4.1.5 Area types Different areas are characterized by their different purposes and uses. -
Reference area is an area that can have reference-related properties different from those of its parent area; -
Viewport area is the clipping/scrolling visible portion of a reference area. -
Allocation area is the basis of positioning and alignment of content within parent; -
Block area is a collection of lines in the block-progression direction; -
Line area is a collection of inline constructs in a block. -
Inline area is an atomic construct or collection of glyph constructs in the inline-progression direction. -
Glyph area is a single text character. 4.1.6 Stacking area and rectangle relationships Areas stack in either the block-progression direction or the inline-progression direction using rectangles. Areas that are stacked adjacent to their siblings are considered "normal." A block area without borders is positioned between siblings; Initial property values are for "common sense" formatting. A child area with a border contains nested rectangles. -
This allows for a rigorous specification of formatting intent, spaced relative to the directions of the parent area. -
Border rectangle is positioned relative to the parent or adjacent area using margin-* or space-* spacing properties. -
Padding rectangle is positioned relative to border rectangle using border-* width properties. -
Content rectangle is positioned relative to padding rectangle using padding-* spacing properties. Border and padding widths are sometimes ignored. -
For example, they are not applicable to regions, floats, or footnote bodies. -
border-style value of " none " or " hidden " will set the border width to 0pt . -
border-before-width and border-after-width have .conditionality component with the initial value of " discard "; -
it sets the .length component to 0pt if it is, respectively, the first or last area in a reference area; -
they may be set to " retain " to preserve the .length component value. An area is stacked within its parent's content rectangle using spacing extents, as shown in Figure 4-4. Figure 4-4. Nested rectangles in stacked block areas The border rectangle is different from the spacing and padding rectangles. -
Spacing and padding rectangles and dimensions define invisible non-rendered areas. -
The border rectangle and border width properties define the thickness of a visible rendered border. -
Not shown are the *-top , *-bottom , *-left , and *-right properties for padding-* and border-* which directly correspond to the writing direction dependent properties. An area's content rectangle in turn contains the area's children. -
The area's type governs what is allowed for the child areas. -
Only a reference area's children can discard conditional spaces. -
Only when the area is a reference area can the content rectangle have orientation properties different from itself. -
Orientation properties and traits are relative to the "top" of the area. -
Examples include reference-orientation , block-progression direction, etc. -
An area's content rectangle orientation properties are relative to the content's own reference orientation, not the area's reference orientation. -
Proportional *-indent and margin-* specifications are calculated differently. -
Specifying conflicting values will over-constrain requirements. -
margin-* properties take precedence over *-indent properties. -
*-indent properties take precedence over space-* properties. -
start-indent and the content's specified inline-progression dimension take precedence over end-indent . -
Examples are inline-progression-dimension on the object or specified for the objects children's sizes. -
If the inline-progression dimension is not explicitly set for the object or its children, the end-indent is respected. 4.1.7 Allocation rectangles and alignment A child area's allocation rectangle describes constraints of position within parent. -
It defines the mechanics of the stacking of adjacent areas. -
Dimension is based on either the parent, border, or content edges. -
Orientation is based on parent area. -
The start edge of an inline area's allocation rectangle defines the alignment point of the area. -
The space outside of the allocation rectangle can be discarded. Block area stacking and allocation rectangle definition is shown in Figure 4-5. Figure 4-5. Block-area allocation rectangle Inline areas defined with a normal allocation rectangle are shown in Figure 4-6. -
Most inline areas are defined with the normal relationship between areas. -
Note how the bordering of such an area will not influence the line stacking and may cause undesirable overwriting of content on the previous and following lines. Figure 4-6. Normal inline area allocation rectangle Inline areas defined with a large allocation rectangle are shown in Figure 4-7. -
Some inline areas are defined with an alternative relationship between areas. -
Note how the bordering of such an area will influence the line stacking and will not cause undesirable overwriting of content on the previous and following lines when the line-stacking strategy is based on the height of the content. Figure 4-7. Large inline-area allocation rectangle 4.1.8 Line areas Line areas are special areas only created by creating a block area. -
Line area traits are specified in the block properties. -
They stack in the block-progression direction. -
They have no borders or padding. Line stacking strategy determines which rectangle describes the line. -
" nominal- requested -line-rectangle " is based on font height and: -
is selected using the line-stacking-strategy value of " font-height ", -
reaches above the text baseline by the text altitude, -
reaches below the text baseline by the text depth, -
provides constant baseline-to-baseline spacing. -
" maximum-line-rectangle " (the initial value for this property) is based on inline objects within line and: -
is selected using the line-stacking-strategy value of " max-height ", -
is equal to the maximum of the allocation-rectangle heights of all contained inline objects as well as that of the nominal-requested-line-rectangle , -
provides constant space between line areas. -
" per-inline-height-rectangle " is based on leading and: -
is selected using the line-stacking-strategy value of " line-height ", -
provides CSS-style line box stacking when using zero space before and space after. Leading is calculated as difference between line height and font size. -
Leading is the space found between the lines of a block. -
The half-leading trait is used by the formatter before and after lines. -
The use of half-leading accommodates adjacent lines with vastly different font sizes without having to decide which line's leading should apply. -
Both lines' half-leading traits apply to the gap between lines. -
The initial value of line-height is " normal ". -
Processor can implement any "reasonable" (sic) value based on font size. -
A value between 1.0 and 1.2 is recommended. -
When not specified, different initial values in different processors will yield different area trees and resulting formatting. -
You can override " normal " by specifying a number (e.g. " 1 " or " 1.1 ") or percentage factor of the current font size. -
You can also specify absolute length value. Geometric font characteristics are based on the em box. -
This refers to the relative measure of the height of the glyphs in the font. -
A box that is 1 em wide by 1 em high is called the design space. -
Design space origin (dominant baseline) is different for ideographic, Indic, and other scripts (e.g. alphabetic and syllabic). Inline constructs align along one of many baselines defined at the same time, as detailed in Area Alignment Properties ( 7.13 ). When not specified, the automatic dominant baseline is based on the current font. Different baselines are -
alphabetic : -
ideographic : -
hanging : -
mathematical : -
after-edge : -
before-edge : -
central : -
middle : -
is at the center of the ex box sitting on the alphabetic baseline, -
is approximated by central when the script doesn't have x-height, -
text-after-edge : -
is equal to the ideographic baseline for ideographic scripts, -
is equal to the bottom of the space for descending characters for non-ideographic scripts, -
text-before-edge : Different values for alignment-adjust are shown in Figure 4-8. -
This shows a bordered block with simple text along the dominant baseline with descending letters. -
A graphic image sits on the dominant baseline (default). -
A square inline container of size 1 em sits on the dominant baseline (default; alphabetic in this example). -
A graphic image is aligned to the after-edge baseline. -
A container is aligned to the after-edge baseline. -
A graphic image is aligned to the middle baseline. -
A container is aligned to the middle baseline. -
The leading is turned off by using line-height="1" . -
This shows the before/after edges of the inline container touching the inside edges of the parent line area. -
The half-leading seen in the previous example above and below the inline container has been removed by adjusting the line height. Figure 4-8. Alignment of inline constructs 4.1.9 References in the area tree The first normally-flowed area created by an object with a specified id property will have the value as a trait. Objects can refer to other objects in the tree creating a reference to the area produced. -
Page number citations use ref-id . -
Hyperlink targets use internal-destination . -
When more than one object has the same identifier, references are resolved to the first area in the area tree created by the first object with the identifier. -
When no object has the required identifier, the formatter signals an error of being unable to meet the requirements. Note it is unsafe to use XML ID and IDREF constructs directly in an XSL-FO instance when combining XML source documents. It is safest when using XSLT to convert every ID and corresponding IDREF to the generate-id () value for the node corresponding to the element with the ID. -
The value space for generate-id() is guaranteed to be unique for every node of all node trees used in a single transformation process. -
For an element with an ID identifier, use the generated identifier of the element, e.g.: -
For a reference with an IDREF identifier, use the generated identifier of the referenced element, e.g.: This is also the safest approach when synthesizing relationships where ID/IDREF is not used, e.g.: |