APP in Arbortext Styler > Components of Documents and Templates > Text Processing > Text Formatting
  
Text Formatting
Introduction
Arbortext Advanced Print Publisher is a template-based system and it handles content in a different way to those applications that use stylesheets. Understanding how Arbortext Advanced Print Publisher formats text is fundamental to understanding how Arbortext Advanced Print Publisher works. Without this knowledge it is difficult to make source edits in Arbortext Styler, build efficient templates, or debug Arbortext Advanced Print Publisher code.
There are two main methods with which Arbortext Advanced Print Publisher template designers can associate Arbortext Advanced Print Publisher 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 Arbortext Advanced Print Publisher 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 Arbortext Advanced Print Publisher’s Formatting Process
In Arbortext Advanced Print Publisher 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 Arbortext Advanced Print Publisher documents flows, as does the XML instance being formatted using an Arbortext Styler stylesheet. Arbortext Advanced Print Publisher 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, Arbortext Advanced Print Publisher 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:
Arbortext Advanced Print Publisher outputs the content using the formatting properties that are in effect. Arbortext Advanced Print Publisher 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, Arbortext Advanced Print Publisher recalls the formatting state at the end of the previous frame and applies those properties.
When Arbortext Advanced Print Publisher 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, Arbortext Advanced Print Publisher ends up with a tag to process.
If the tag is anything other than JavaScript, Arbortext Advanced Print Publisher 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, Arbortext Advanced Print Publisher 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 Arbortext Advanced Print Publisher code.
If the tag is JavaScript, Arbortext Advanced Print Publisher runs that tag as JavaScript.
If Arbortext Advanced Print Publisher encounters a processing instruction, it searches its own processing instructions to find a match. If a match is found, it executes the associated instruction. Arbortext Advanced Print Publisher processing instructions are used to set formatting properties.
If Arbortext Advanced Print Publisher encounters a comment, it ignores it.
The Arbortext Advanced Print Publisher 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, Arbortext Advanced Print Publisher exits and continues the formatting process.
When Arbortext Advanced Print Publisher 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 Arbortext Advanced Print Publisher reaches the end of the frame or the end of the stream.