Text Layout Framework Markup

Text Layout Framework Markup provides the highest fidelity representation of text in a TextFlow because the markup language provides not only tags for each of the TextFlow hierarchy’s basic elements, but also attributes for all formatting properties available in the TextLayoutFormat class.

The following table contains the tags that can be used in Text Layout Framework Markup.

Element

Description

Children

Class

textflow

The root element of the markup.

div, p

TextFlow

div

A division within a TextFlow. May contain a group of paragraphs.

div, p

DivElement

p

A paragraph. May contain any of the elements listed in the rows below.

a, tcy, span, img, tab, br

ParagraphElement

a

A link.

tcy, span, img, tab, br

LinkElement

tcy

A run of horizontal text (usually used in a vertical TextFlow).

a, span, img, tab, br

TCYElement

span

A run of text within a paragraph.

 

SpanElement

img

An image in a paragraph.

 

InlineGraphicElement

tab

A tab character.

 

TabElement

br

A break character. Used for ending a line within a paragraph; text will continue on the next line, but remain in the same paragraph.

 

BreakElement

format

An instance of the TextLayoutFormat class.

 

TextLayoutFormat

The formatting properties, which can be found in the TextLayoutFormat class, can be assigned directly to an element tag as an XML attribute. For example, in the following Text Layout Framework Markup the fontSize of the entire TextFlow is 14 and the color of the second paragraph is blue except for the last SpanElement, which is red because the color attribute in the last SpanElement overrides the color attribute of its parent in the hierarchy.

<flow:TextFlow xmlns:flow="http://ns.adobe.com/textLayout/2008" fontSize="14"> 
    <flow:p>This is an example of Text Layout Framework Markup.</flow:p> 
    <flow:p color="#0000ff"> 
        <flow:span>This is the first span of the second paragraph.</flow:span> 
        <flow:span color="#ff0000">This is the second span of the second                                         paragraph.</flow:span> 
    </flow:p> 
</flow:TextFlow>;

You can also use the format tag to create a named set of formatting properties, which behaves like an instance of the TextLayoutFormat class. In the following example, a named set of properties called “english” is applied to a span of text.

<TextFlow  xmlns="http://ns.adobe.com/textLayout/2008" fontSize="14"> 
    <format id="english" locale="en" fontFamily="Minion Pro"/> 
    <p paragraphSpaceAfter="15"><span>This is supposed to use the default font</span></p> 
    <p paragraphSpaceAfter="15"><span format="english">This is supposed to be in Minion Pro via a named format</span></p> 
    <p><span fontFamily="Minion Pro">This is supposed to be in Minion Pro via a fontFamily attribute</span></p> 
</TextFlow>

If a property is set using both a named set and direct assignment to an element tag, the direct assignment value will apply.