Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 3 - QuickDraw Text / QuickDraw Text Reference
Routines / Laying Out a Line of Text


VisibleLength

The VisibleLength function calculates the length in bytes of a given text segment, excluding trailing white space.

FUNCTION VisibleLength (textPtr: Ptr; 
                        textLength: LongInt): LongInt;
textPtr
A pointer to a text string.
textLength
The number of bytes in the text segment.
DESCRIPTION
The VisibleLength function determines how much of a style run to display, without displaying trailing spaces. You call VisibleLength for the last style run of a line in memory order. The last style run in memory order of the text constituting the line is not always the last style run in display order. For a line of unidirectional left-to-right text, the last style run in memory order is the rightmost style run in display order. For a line of unidirectional right-to-left text, the last style run in memory order is the leftmost style run in display order. However, if the text contains mixed directions, the last style run in memory order may be an interior style run in display order.

The text justification routines do not automatically exclude trailing spaces, so you pass them the value that VisibleLength returns as the length of the last style run in memory order.

The VisibleLength function behaves differently for various script systems.

Advancing the pointer in memory in response to VisibleLength
The purpose of VisibleLength is to trim off white space at the display end of the line. The VisibleLength function does not eliminate the white space by removing its character code from memory. Rather, it does not include white space characters in the count that it returns as the length of the range of text for which you call it.
For more information about VisibleLength, see the task description "Eliminating Trailing Spaces (for Justified Text)" on page 3-36.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996