TTextLineLayout is responsible for measuring, highlighting, displaying, and hit-testing a line of text. TTextLineLayout uses a TLinePlacement to describe information about the position of the line.
When you initialize a TTextLineLayout object, it generates the line and caches it for display or other operations; it regenerates the line whenever necessary. You generally create a TTextLineLayout object and reuse it to lay out multiple lines
of text.
TLinePlacement provides the abstract protocol for positioning a line of text. You should not need to call TLinePlacement functions directly. They are called only by TTextLineLayout. TTextLineLayout provides a default line placement object suitable for laying out English and other languages based on the Roman script.
The system includes two concrete classes derived from TLinePlacement. These classes correctly handle both vertical and horizontal text:
TSingleLineOrientation, also used by the TTextDisplay and TTextGraphic classes, provides a control for a single line of text, including information about the direction of the text, the sequence of elements within the text (for example, tabs), and the justification.
NOTE The static text display classes also use the class TMultiLineOrientation, derived from TSingleLineOrientation, to control the layout of multiple lines of classes simultaneously. TMultiLineOrientation additionally holds information about the relative placement of multiple lines. See "Displaying static text" on page 68 for more information.
TCaretPlace describes the position at which a caret should be displayed on a line. Each TCaretPlace is defined by a position (a TGPoint) and a slope. The slope is used to draw a caret with a slope compatible with the immediate text. TTextLineLayout calculates caret positions using the current TInsertionOffset. TInsertionOffset is part of the Basic Text framework and is described in "Representing insertion points" on page 39.
When an insertion point is represented by two carets (as in scripts such as Hindi, Arabic, and Hebrew), each TCaretPlace additionally specifies the directionality of the character with which it is associated and whether the caret appears to the left or to the right of the character.
TTextLineLayoutHyphenationInfo encapsulates device dependent information about how to handle and display hyphens--whether the line layout instance should display all soft hyphens, no soft hyphens, or the last soft hyphen on the line.
The Line Layout system also includes a class that other Line Layout classes use to throw exceptions--TLineLayoutException, derived from TStandardException. TLineLayoutException defines the following exception conditions:
Exception handling
Exception | Description | |
kNoException | Default exception value | |
kUndefinedFunction | Caller invoked an undefined function | |
kStaticDataInvalid | Static data owned by a line layout object is not in a valid state |