Controlling line layout

The primary class provided by Line Layout is TTextLineLayout. TTextLineLayout uses a number of other classes to encapsulate specific data and to pass it along to clients. This figure shows TTextLineLayout and its related classes.


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:

CAUTION Always use TLinePlacement derived classes provided by Taligent. Objects of this class will be streamed to foreign devices and must be able to resurrect themselves on foreign devices. Classes you derive from TLinePlacement yourself will not be able to do so.

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.

Exception handling

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 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


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker