Important: The information in this document is obsolete and should not be used for new development.
StdTxMeas
TheStdTxMeas
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
TheStdTxMeas
function is a QuickDraw bottleneck routine that the QuickDraw text-measuring routines use extensively. TheStdTxMeas
function returns the width of the text stored in memory beginning with the first character attextAddr
and continuing forbyteCount
bytes. You can call theStdTxMeas
function directly, for example, to measure text that you want to explicitly scale, but not justify. You can also useStdTxMeas
to get the font metrics for scaled text in order to determine the line height, instead of usingGetFontInfo
, which doesn't support scaling.On input, you need to specify values for
numer
anddenom
, 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
anddenom
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
andFixRatio
functions to help with this process. For more information, see "Using Scaled Text" on page 3-43.SPECIAL CONSIDERATIONS
TheStdTxMeas
routine gives the correct results for all script systems. ThebyteCount
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.