PTC ALD in Arbortext Styler > Components of Documents and Templates > Text Processing > Text Formatting
  
Text Formatting
Introduction
PTC Arbortext Layout Developer is a template-based system and it handles content in a different way to those applications that use stylesheets. Understanding how PTC Arbortext Layout Developer formats text is fundamental to understanding how PTC Arbortext Layout Developer works. Without this knowledge it is difficult to make source edits in Arbortext Styler, build efficient templates, or debug PTC Arbortext Layout Developer code.
There are two main methods with which PTC Arbortext Layout Developer template designers can associate PTC Arbortext Layout Developer code with markup in content:
Include a tag name that matches the element name in the content
Refer to Element-based Tag Selection for information.
Use a context control stream tag that defines the code that PTC Arbortext Layout Developer should execute when it matches a context in the XML content. This method is specific to XML publishing.
Refer to Context-based Tag Selection for information.
While both mechanisms are active by default, a template can be simplified by using one method throughout.
Overview of PTC Arbortext Layout Developer’s Formatting Process
In PTC Arbortext Layout Developer text content is added to the page by placing it in frames. A frame can specify that the content flows or repeats.
Flowing text — when the text fills up the frame it overflows and can continue in the next frame that has that text stream attached. The next frame can be on the same page or the next. The main content stream in PTC Arbortext Layout Developer documents flows, as does the XML instance being formatted using an Arbortext Styler stylesheet. PTC Arbortext Layout Developer can have multiple content flows running concurrently through the document.
Repeating text — overflowing content is discarded. When the content stream is seen again, formatting restarts from the top of the stream. Items such as headers and footers are examples of repeating text.
By default, PTC Arbortext Layout Developer starts formatting a content stream at the top. The top is either the beginning of the content stream (on the first page of flowing content or repeating text) or the point at which the content overflows from the previous frame. From here the formatting process follows these steps:
PTC Arbortext Layout Developer outputs the content using the formatting properties that are in effect. PTC Arbortext Layout Developer applies default text formatting properties when no styling has been encountered – 12pt Times New Roman with 1.2x height leading. If the content is a continuation of overflowed content, PTC Arbortext Layout Developer recalls the formatting state at the end of the previous frame and applies those properties.
When PTC Arbortext Layout Developer encounters markup, whether an entity reference, element, processing instruction (PI), or comment, it handles it in a specific way depending on the type. For elements and entity references, PTC Arbortext Layout Developer ends up with a tag to process.
If the tag is anything other than JavaScript, PTC Arbortext Layout Developer processes its content as if it is a continuation of the content stream being formatted.
If the tag contains markup, that markup is processed as if it is part of the main content stream. When it has finished processing, PTC Arbortext Layout Developer exits into the current tag being processed. Nesting of tags within tags is limited to 20 levels.
The nesting level can be obtained using the fFormatting.streamHierarchy property, an array of fFormatPos objects. These objects give information about the tag being processed, its attributes, and the tag that called it. This information can be very useful for debugging PTC Arbortext Layout Developer code.
If the tag is JavaScript, PTC Arbortext Layout Developer runs that tag as JavaScript.
If PTC Arbortext Layout Developer encounters a processing instruction, it searches its own processing instructions to find a match. If a match is found, it executes the associated instruction. PTC Arbortext Layout Developer processing instructions are used to set formatting properties.
If PTC Arbortext Layout Developer encounters a comment, it ignores it.
The PTC Arbortext Layout Developer tag that is processed usually contains instructions to change formatting, either processing instructions or JavaScript formatting instructions. These change the formatting of any content that follows, for example starting new blocks, tables, or paragraphs, or changing the current style properties.
Once the current tag has been processed, PTC Arbortext Layout Developer exits and continues the formatting process.
When PTC Arbortext Layout Developer encounters a hard return it reverts the formatting properties to the defaults in effect at that point.
If hard returns have been mapped to spaces using whitespace handling settings on the stream, this revert does not occur. Refer to Basic Text Streams for information on text streams and whitespace.
This process continues until PTC Arbortext Layout Developer reaches the end of the frame or the end of the stream.