XFA Specification
Chapter 2, Template Features for Designing Static Forms
Basic Layout
63
Containers” on page 218).
The enclosing container can also control the initial direction of text flow (left to
right or right to left) and rules for word parsing by specifying a locale. The enclosing container cannot
specify any line-wrapping technique; however, XFA processing applications typically employ some a
wrapping technique to place a long stream of flowed content into its nominal content region. Text is
typically flowed over one or more lines, breaking at word boundaries.
The examples in this section assume the text stream shown below, which also serves to illustrate the
organization of text data. The sequence
“&nl;”
stands for the newline indicator, which separates text
records.
To be, or not to be: that is the question:&nl;Whether 'tis nobler in the mind
to suffer&nl;The slings and arrows of outrageous fortune,&nl;Or to take arms
against a sea of troubles,&nl;And by opposing end them?
When placing text into a fixed-width region the text records are interpreted as paragraphs. The layout
processor starts each new paragraph on a new line. Within each paragraph the layout processor treats the
text as a string of text layout units. A text layout unit may be an embedded non-text object or it may be a
word. The boundaries of layout units may be delimited by the edges of embedded non-text objects or by
white space characters. In many languages text layout units are words, separated by
white space.
However
not all languages use white space to delimit words. Therefore, the parsing of words is
language-dependant. Which languages are supported is implementation-dependant, but all
implementations should support some locale that uses the Unicode Basic Latin and Latin-1 Supplement
character codes (U0021 through U007E inclusive). The complete rules for parsing words are given in
Unicode Standard Annex 14
[UAX-14].
Note that these rules were first adopted in XFA 2.2.
The initial flow direction depends on the locale. However a single paragraph of text can contain text from
different languages that flows in different directions. For example, the language of the locale is Arabic so
the initial flow direction is right to left. However the text contains a phrase in English that flows from left to
right. The flow direction of the English phrase may be explicitly indicated by codes reserved for this
purpose in Unicode, or the text engine can infer it from the use of English letters in the phrase. The whole
complicated set of rules is specified in Unicode Annex 9
[UAX-9].
By applying these rules the text layout
engine divides the paragraph into segments, such that within each segment the flow is all in one direction.
Note:
Unicode Annex 9 has been widely embraced and incorporated into many other standards. However
Microsoft has its own way of doing things which is close to, but not quite in accordance with, the
Unicode standard. Do not expect XFA flow direction to exactly match the behavior of
non-conformant software.
If the container has fixed dimensions and the flowed text exceeds the boundaries of the container, the
view of the text must be adjusted as described in
“Clipping” on page 59.
Text Layout in the Horizontal Direction
Layout units within a paragraph are placed in document order in the flow direction on each line, along
with any white space between them. The line stops when the text is exhausted or the next thing is a text
layout unit (i.e. not white space) and it cannot be placed on the line without exceeding the width of the
region. At this point trailing white space on the line is discarded.
Next the layout units within the line are reordered in accordance with the direction of the segment in
which each is embedded. See Unicode Annex 9
[UAX-9]
for details.
The line is now ready to be positioned within the region. The tables
“Influence of hAlign on alignment of
text” on page 64
further describe horizontal text alignment.
Home Index Bookmark Pages
Pages: Home Index All Pages