Class: TTextLineLayout

Declaration: LineLayout.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

None.

Purpose:

This class provides the basic interfaces and functionality for laying out lines of text.

Instantiation:

Allocate on the heap or the stack. Because of the size of this class, it is usually better to allocate on the heap and re-use TTextLineLayout instances rather than allocate repeatedly on the stack.

Deriving Classes:

Do not derive unless you are implementing your own version of Line Layout.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Member Function: TTextLineLayout::GetNearestEdge

virtual void GetNearestEdge (const TGrafMatrix & resolution, const TTextRegion & textSelection, const TGPoint & position, TInsertionOffset & retip) const

Interface Category:

API.

Purpose:

Returns the insertion point nearest the indicated point within the indicated selection.

Calling Context:

Called when extending ranges in a discontiguous selection.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetTextRangeForLine

virtual void GetTextRangeForLine (const TGrafMatrix & resolution, TTextRegion & result) const

Interface Category:

API.

Purpose:

Returns the range of the entire line.

Calling Context:

Called when computing discontiguous ranges.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetTextRangeFromInsertionPoints

virtual void GetTextRangeFromInsertionPoints (const TGrafMatrix & resolution, const TInsertionOffset & ip1, const TInsertionOffset & ip2, TTextRegion & result) const

Interface Category:

API.

Purpose:

Returns the range of the text between the indicated insertion points.

Calling Context:

Called when computing discontiguous ranges.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetTextRangeUntilLineStart

virtual void GetTextRangeUntilLineStart (const TGrafMatrix & resolution, const TInsertionOffset & ip, TTextRegion & result) const

Interface Category:

API.

Purpose:

Returns the range of the text from the indicated insertion point to the start of the line.

Calling Context:

Called when computing discontiguous ranges.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetTextRangeUntilLineEnd

virtual void GetTextRangeUntilLineEnd (const TGrafMatrix & resolution, const TInsertionOffset & ip, TTextRegion & result) const

Interface Category:

API.

Purpose:

Returns the range of the text from the indicated insertion point to the end of the line.

Calling Context:

Called when computing discontiguous ranges.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetRightmostInsertionPoint

virtual void GetRightmostInsertionPoint (const TGrafMatrix & resolution, TInsertionOffset & retip) const

Interface Category:

API.

Purpose:

Returns the right-most insertion point possible on the line.

Calling Context:

Called when a cursor must go to the beginning or end of the line.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetLeftmostInsertionPoint

virtual void GetLeftmostInsertionPoint (const TGrafMatrix & resolution, TInsertionOffset & retip) const

Interface Category:

API.

Purpose:

Returns the left-most insertion point possible on the line.

Calling Context:

Called when a cursor must go to the beginning or end of the line.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetLeftInsertionPoint

  1. virtual void GetLeftInsertionPoint (const TGrafMatrix & resolution, const TTextRange & ts, TInsertionOffset & returnNew) const
  2. virtual void GetLeftInsertionPoint (const TGrafMatrix & resolution, const TTextRegion & ts, TInsertionOffset & returnNew) const

Interface Category:

API.

Purpose:

  1. Returns the insertion point to the left of the current one.
  2. Returns the insertion point to the left of the current one. Use for discontiguous selections.

Calling Context:

  1. Called when text is selected and a cursor key is hit.
  2. Called when discontiguous text is selected and a cursor key is hit.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetPreviousInsertionPoint

virtual void GetPreviousInsertionPoint (const TGrafMatrix & resolution, const TInsertionOffset & old, TInsertionOffset & returnNew) const

Interface Category:

API.

Purpose:

Returns the insertion point previous to the current one.

Calling Context:

Called to recompute the insertion point when a cursor key is hit.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetRightInsertionPoint

  1. virtual void GetRightInsertionPoint (const TGrafMatrix & resolution, const TTextRange & ts, TInsertionOffset & returnNew) const
  2. virtual void GetRightInsertionPoint (const TGrafMatrix & resolution, const TTextRegion & ts, TInsertionOffset & returnNew) const

Interface Category:

API.

Purpose:

  1. Returns the insertion point to the right of the current one.
  2. Returns the insertion point to the right of the current one. Used for discontiguous selections.

Calling Context:

  1. Called when text is selected and a cursor key is hit.
  2. Called when discontiguous text is selected and a cursor key is hit.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetNextInsertionPoint

virtual void GetNextInsertionPoint (const TGrafMatrix & resolution, const TInsertionOffset & old, TInsertionOffset & returnNew) const

Interface Category:

API.

Purpose:

Returns the next insertion point following the current one.

Calling Context:

Called to recompute the insertion point when a cursor key is hit.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetGlyphBounds

virtual void GetGlyphBounds (const TGrafMatrix & resolution, TTextIndex index, TGRect & returnGlyphBox, TGPoint & returnOrigin) const

Interface Category:

API.

Purpose:

Determines the bounds of the glyph where a mouse down has occurred.

Calling Context:

Called when positioning something near a glyph.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetGlyphOrigin

virtual void GetGlyphOrigin (const TGrafMatrix & resolution, const TGPoint & position, TGPoint & returnOrigin, bool & returnDirectHit) const

Interface Category:

API.

Purpose:

Determines the position of the glyph where a mouse down has occurred.

Calling Context:

Called when positioning something near a glyph.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetTextRange

  1. virtual void GetTextRange (const TGrafMatrix & resolution, const TGPoint & position, TTextRange & returnTextRange, bool & returnDirectHit) const
  2. virtual void GetTextRange (const TGrafMatrix & resolution, TTextIndex index, TTextRange & returnSelection) const

Interface Category:

API.

Purpose:

  1. Used to determine the glyph where a mouse-down event has occurred. This function returns a range because a single glyph on the screen may correspond to more than on character in the backing store. Examples are accented Latin letters, Hebrew consonants with vowel points, ligatures, Korean hangul, and Indic glyphs.
  2. Used to determine the glyph where a mouse-down event has occurred. This function returns a range because a single glyph on the screen may correspond to more than on character in the backing store. Examples are accented Latin letters, Hebrew consonants with vowel points, ligatures, Korean hangul, and Indic glyphs.

Calling Context:

  1. Called to determine the range of characters in the backing store corresponding to the glyph at a certain position.
  2. Called to determine the range of characters in the backing store corresponding to the glyph at a certain index within the text being laid out.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetCaretPositions

virtual int GetCaretPositions (const TGrafMatrix & resolution, const TInsertionOffset & insertionPoint, TCaretPlace & primary, TCaretPlace & secondary) const

Interface Category:

API.

Purpose:

Gets the positions of the caret.

Calling Context:

Used to compute the visual caret location for a particular insertion point.

Parameters:

Return Value:

Returns the number of carets.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetInsertionPoint

virtual void GetInsertionPoint (const TGrafMatrix & resolution, const TGPoint & position, TInsertionOffset & returnTextInsertionPoint, bool UseVisualEndOfLine =true) const

Interface Category:

API.

Purpose:

Gets the current insertion point.

Calling Context:

Used to map a mouse position to a character position.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetRangeWidth

  1. virtual GCoordinate GetRangeWidth (const TGrafMatrix & resolution, const TTextRange & textRange) const
  2. virtual void GetRangeWidth (const TGrafMatrix & resolution, const TTextRange & textRange, GCoordinate & retwidth, GCoordinate & retMaxAscent, GCoordinate & retMaxDescent) const

Interface Category:

API.

Purpose:

  1. Gets the width of a specified range of text on the line.
  2. Gets the width of a specified range of text on the line.

Calling Context:

  1. Called to help determine where to break lines.
  2. Called to help determine where to break lines.

Parameters:

Return Value:

  1. The width of the range.
  2. None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetBounds

virtual void GetBounds (const TGrafMatrix & resolution, TGRect & returnBBox) const

Interface Category:

API.

Purpose:

Returns a TGRect bounding the text.

Calling Context:

Called to help determine where to break lines.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetMeasurements

virtual void GetMeasurements (const TGrafMatrix & resolution, GCoordinate & ascent, GCoordinate & descent, GCoordinate & width) const

Interface Category:

API.

Purpose:

Gets the line's ascent, descent, and width.

Calling Context:

Called to help determine where to break lines.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetWidth

virtual GCoordinate GetWidth (const TGrafMatrix & resolution) const

Interface Category:

API.

Purpose:

Gets the width of the line.

Calling Context:

Called to help determine where to break lines.

Parameters:

Return Value:

The width of the line.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetHeight

virtual GCoordinate GetHeight (const TGrafMatrix & resolution) const

Interface Category:

API.

Purpose:

Gets the height of the line.

Calling Context:

Called to help determine where to break lines.

Parameters:

Return Value:

The height of the line.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetAscentDescent

virtual void GetAscentDescent (const TGrafMatrix & resolution, GCoordinate & retTop, GCoordinate & retBottom) const

Interface Category:

API.

Purpose:

Gets the text line's ascent and descent (the distance above and below the baseline).

Calling Context:

Called to help determine where to break lines.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetCursorSlope

virtual bool GetCursorSlope (const TGrafMatrix & resolution, const TGPoint & position, GCoordinate & returnRun, GCoordinate & returnRise, TGArea & validArea, bool useFixedLineHeightValues =false) const

Interface Category:

API.

Purpose:

Gets the slope of the cursor.

Calling Context:

Used during mouse tracking, for example, so that users can select italic text.

Parameters:

Return Value:

Returns false if the text is horizontal and there is no text at the cursor position. Returns true otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetAverageAngleAtCaretSplits

virtual bool GetAverageAngleAtCaretSplits () const

Interface Category:

API.

Purpose:

Queries whether the caret slope is to be averaged between, for example, italic and roman text.

Calling Context:

Called when computing sloped highlight areas.

Parameters:

Return Value:

Returns true if this field is set to true. If true, the slope of the highlight area is averaged at its end points.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::SetAverageAngleAtCaretSplits

virtual void SetAverageAngleAtCaretSplits (bool averageAngleAtCaretSplits =true)

Interface Category:

API.

Purpose:

Determines if the caret slope is to be averaged between, for example, italic and roman text.

Calling Context:

Called to determine if the caret slope is to be averaged between, for example, italic and roman text.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetAngledHighlight

virtual bool GetAngledHighlight () const

Interface Category:

API.

Purpose:

Queries whether highlighting is to be angled (such as for italicized text).

Calling Context:

Called when computing sloped highlight areas.

Parameters:

Return Value:

Returns true if this field is set to true. If true, and SetAverageAngleAtCaretSplits is false, the highlight area is sloped to match the characters at the end points.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::SetAngledHighlight

virtual void SetAngledHighlight (bool angledHilight =true)

Interface Category:

API.

Purpose:

Determines whether highlighting is to be angled (such as for italicized text).

Calling Context:

Called to determine whether highlighting is to be angled (such as for italicized text).

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetHighlightArea

  1. virtual void GetHighlightArea (const TGrafMatrix & resolution, const TTextRange & textRange, TGArea & highlightArea, bool useFixedLineHeightValues =false, bool useMargins =false) const
  2. virtual void GetHighlightArea (const TGrafMatrix & resolution, const TTextRegion & textSelection, TGArea & highlightArea, bool useFixedLineHeightValues =false, bool useMargins =false) const

Interface Category:

API.

Purpose:

  1. Gets the highlighted area of text line.
  2. Gets the highlighted area of text line, for discontiguous selections.

Calling Context:

  1. Called to compute a highlight area for a text range.
  2. Called to compute a highlight area for a text region.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

This function replaces the highlight area passed in with the highlight area for the line. Use AddToHighlightArea to add the highlight area passed in to the highlight area for the line.

Member Function: TTextLineLayout::Draw

  1. virtual void Draw (TGrafPort & port, bool useFixedLineHeightValues =false) const
  2. virtual void Draw (const TGrafMatrix & resolution, TGrafPort & port, bool useFixedLineHeightValues =false) const

Interface Category:

API.

Purpose:

  1. Draws the line of text.
  2. Draws the line of text.

Calling Context:

  1. Called (for example, by editable text and text displays) to draw text where the display resolution is unknown.
  2. Called (for example, by editable text and text displays) to draw text where the display resolution is known.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::ResetRangeStart

virtual void ResetRangeStart (TTextIndex)

Interface Category:

API.

Purpose:

Resets the beginning of the text range.

Calling Context:

Call whenever the range is altered.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetFixedLineHeight

virtual void GetFixedLineHeight (GCoordinate & top, GCoordinate & bottom) const

Interface Category:

API.

Purpose:

Gets the fixed value for the line height.

Calling Context:

Called to get these values when drawing and highlighting.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::SetFixedLineHeight

virtual void SetFixedLineHeight (const GCoordinate top =0, const GCoordinate bottom =0)

Interface Category:

API.

Purpose:

Sets the fixed value for the line height. If this value is 0, the natural ascent and descent are used instead.

Calling Context:

Called to set this value.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetOrigin

virtual void GetOrigin (TGPoint & returnOrigin) const

Interface Category:

API.

Purpose:

Gets the text line's origin.

Calling Context:

Called to get the origin for drawing.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::SetOrigin

virtual void SetOrigin (const TGPoint & origin)

Interface Category:

API.

Purpose:

Sets the text line's origin.

Calling Context:

Call to vertically reposition the line.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::SetText

virtual void SetText (const TText * aliasedText, const TTextRange & range =TTextRange :: GetMaximumRange (), const TGPoint & baselineOrigin =kZeroTGPoint, const TLinePlacement & linePlacement =kLeftFlushRoman, const TStyleSet * aliasedDefaultLineStyleSet =NIL, const TTextLineLayoutHyphenationInfo & hyphenationParameters =kDefaultHyphenationParms)

Interface Category:

API.

Purpose:

Sets the text to be laid out on the line.

Calling Context:

Call to initialize or reuse a TTextLineLayout instance.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::~TTextLineLayout

virtual ~ TTextLineLayout ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::TTextLineLayout

TTextLineLayout ()

Interface Category:

API.

Purpose:

Default constructor.

Calling Context:

Called by the stream-in operators and to instantiate this class.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetMaximumFittingOffset

virtual TTextOffset GetMaximumFittingOffset (const TGrafMatrix & resolution, const TTextOffset & startOffset, const GCoordinate & maximumWidth) const

Interface Category:

API.

Purpose:

Given an initial offset and a width finds the maximum offset within the text such that the width of the text between the offsets is not greater than the given width.

Calling Context:

Used by editable text in wrapping lines of text. Editable text knows the offset of the line's beginning and the width into which the line should fit. It uses this function to make a first approximation of where the line should be broken.

Parameters:

Return Value:

The highest offset within the line that will fit within the given width.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::AddToHighlightArea

  1. virtual void AddToHighlightArea (const TGrafMatrix & resolution, const TTextRange & textRange, TGArea & highlightArea, bool useFixedLineHeightValues =false, bool useMargins =false) const
  2. virtual void AddToHighlightArea (const TGrafMatrix & resolution, const TTextRegion & textSelection, TGArea & highlightArea, bool useFixedLineHeightValues =false, bool useMargins =false) const

Interface Category:

API.

Purpose:

  1. Finds the highlight area for a line and adds it to the area parameter passed in.
  2. Finds the highlight area for a line and adds it to the area parameter passed in.

Calling Context:

  1. Used by editable text to create multi-line selections.
  2. Used by editable text to create multi-line selections.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

This function adds the highlight area passed in to the highlight area for the line. Use GetHighlightArea to replace the highlight area passed in with the highlight area for the line.

Member Function: TTextLineLayout::GetRange

virtual void GetRange (TTextRange & range) const

Interface Category:

API.

Purpose:

Gets the text range associated with this line layout instance.

Calling Context:

Used to get the text range associated with this line layout instance.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TTextLineLayout::GetLinePlacement

virtual const TLinePlacement * GetLinePlacement () const

Interface Category:

API.

Purpose:

Provides access to the TLinePlacement object used by a given TTextLineLayout object to lay out text.

Calling Context:

Called to obtain access to the TLinePlacement object used by a given TTextLineLayout object to lay out text.

Parameters:

Return Value:

Returns a pointer to the TLinePlacement object used by a given TTextLineLayout object to lay out text. The storage is owned by the TTextLineLayout object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.