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 / Low-Level QuickDraw Text Routines


StdTxMeas

The StdTxMeas function measures the width of scaled or unscaled text.

FUNCTION StdTxMeas (byteCount: Integer; textAddr: Ptr;
                    VAR numer, denom: Point;
                    VAR info: FontInfo): Integer;
byteCount
The number of bytes to be counted.
textAddr
A pointer to the beginning of the text in memory.
numer
A point giving the numerator for the horizontal and vertical
scaling factors.
denom
A point giving the denominator for the horizontal and vertical
scaling factors.
info
A font information record that describes the current font.
DESCRIPTION
The StdTxMeas function is a QuickDraw bottleneck routine that the QuickDraw text-measuring routines use extensively. The StdTxMeas function returns the width of the text stored in memory beginning with the first character at textAddr and continuing for byteCount bytes. You can call the StdTxMeas function directly, for example, to measure text that you want to explicitly scale, but not justify. You can also use StdTxMeas to get the font metrics for scaled text in order to determine the line height, instead of using GetFontInfo, which doesn't support scaling.

On input, you need to specify values for numer and denom, even if you are not scaling the text. You can specify 1,1 scaling factors, in this case, so that no scaling is applied. On return, numer and denom contain the additional scaling to be applied to the text. For more information about the input scaling factors, see "The numer and denom Parameters" on page 3-64.

The StdTxtMeas function returns output scaling factors that you need to apply to the text to get the right measurement if the Font Manager was not able to fully satisfy the scaling request. You can use the Toolbox Utilities' FixRound and FixRatio functions to help with this process. For more information, see "Using Scaled Text" on page 3-43.

SPECIAL CONSIDERATIONS
The StdTxMeas routine gives the correct results for all script systems. The byteCount parameter is the number of bytes of the text to be drawn, not characters. When specifying this value, consider that 2-byte script systems also include characters consisting of only one byte.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996