Important: The information in this document is obsolete and should not be used for new development.
VisibleLength
TheVisibleLength
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
TheVisibleLength
function determines how much of a style run to display, without displaying trailing spaces. You callVisibleLength
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.
- For simple script systems, such as Roman and Cryllic, and for 2-byte script systems,
VisibleLength
does not include in the byte count it returns trailing spaces that occur at the display end of the text segment. For 2-byte script systems,VisibleLength
does not count them, whether they are 1-byte or 2-byte
space characters.- For 1-byte complex script systems,
VisibleLength
does not include in the byte count that it returns spaces whose character direction is the same as the primary line direction. For 1-byte complex script systems that support bidirectional text, Roman spaces take on a character direction based on the primary line direction. If the Roman spaces then fall at the end of the text,VisibleLength
does not include them in the returned byte count.
For more information about
- 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. TheVisibleLength
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.VisibleLength
, see the task description "Eliminating Trailing Spaces (for Justified Text)" on page 3-36.