XFA Specification
Chapter 2, Template Features for Designing Static Forms
Basic Layout
50
Basic Layout
This section describes the most common aspects of how objects are arranged and presented on the
presentation medium.
It explains how the objects that appear on a page can be positioned relative to the page and to one
another. It explains how contentArea, pageArea, and pageSet can be used on a simple static form. Such
simple forms used a positioned layout strategy in which every subform is directly linked to a named
contentArea. This section also describes text flow and justification.
The Layout Processor
The job of the layout processor is to assign each layout object an absolute position on a page. When
positioned layout is used for every subform the layout process is simple. Each contentArea is located at an
absolute position on a particular page. Each subform is positioned relative to a particular contentArea. The
layout objects within the subform are positioned relative to the subform. Hence to compute the absolute
position and page of each object the layout processor only needs to trace up the tree of containers,
integrating relative positions, until it reaches a contentArea which resolves the relative position to an
absolute position and page.
Box Model
In order to understand the ways in which relative positions are calculated it is necessary to understand the
box model. Layout employs a box model in which model objects (both containers and displayable entities)
are represented by simple rectangles called nominal extents. Each nominal extent is aligned with the X
and Y axes and represents the amount of physical space on the page that is reserved for a particular
object. Some nominal extents are calculated at run time, for example the extents for blocks of variable text
in fields. Other nominal extents are presupplied.
Some layout objects (subforms, fields, images, draws containing geometric figures, and contentAreas) may
have nominal extents supplied explicitly via the
w
(width) and
h
(height) attributes. Each of these
attributes, if supplied, must be set to a measurement. The object's margins, if any, and its caption, if any, lie
inside the nominal extent. When nominal extents are explicitly supplied for all possible layout objects the
result is a form that has a fixed appearance regardless of the data, analogous to a pre-printed paper form.
When a width or height is supplied to an object explicitly by
w
and/or
h
attributes, the layout processor
must use the supplied width and/or height in the nominal extent, regardless of the content of the object.
Therefore the nominal extent may be larger or smaller than the visual representation of the object. A
nominal extent that is smaller than the visual representation of an object may lead to clipping or
unwanted overlap in a subsequent rendering step, but this is no concern of the layout processor.
Some objects, including draws and subforms, may have borders. Thick borders may extend beyond the
nominal extent of the object or on top of content but they do not affect layout processing. However
borders are affected by layout; the location of a border is determined by the nominal extent of the object
in combination with its border inset.