Important: The information in this document is obsolete and should not be used for new development.
StdTxMeas
TheStdTxMeasfunction 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
TheStdTxMeasfunction is a QuickDraw bottleneck routine that the QuickDraw text-measuring routines use extensively. TheStdTxMeasfunction returns the width of the text stored in memory beginning with the first character attextAddrand continuing forbyteCountbytes. You can call theStdTxMeasfunction directly, for example, to measure text that you want to explicitly scale, but not justify. You can also useStdTxMeasto 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
numeranddenom, 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,numeranddenomcontain 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
StdTxtMeasfunction 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'FixRoundandFixRatiofunctions to help with this process. For more information, see "Using Scaled Text" on page 3-43.SPECIAL CONSIDERATIONS
TheStdTxMeasroutine gives the correct results for all script systems. ThebyteCountparameter 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.