TextWidth
TextWidth
Query width of unformatted text, in pixels short TextWidth(textPtr, startOffset, count ); Ptr textPtr ; address of a buffer containing text to measure short startOffset ; offset of character to start measuring
short count ; number of characters to measure
returns width, in pixels, text would occupy
TextWidth returns the width, in pixels, a series of characters would occupy if they were drawn immediately. It takes into consideration the current font,
size, and style.
textPtr is the address of a buffer containing unformatted text to measure.
startOffset is the offset from textPtr of the first character you wish measured.
To measure a C string, just use 0.
count is the number of characters to measure (starting at
textPtr+startOffset ). For C strings, just use strlen(textPtr ).
Returns: the width of the specified text, in pixels.
sum of the widths obtained by that call.
MeasureText to obtain an array, with each element containing the width of the text from the start to the right edge of the corresponding character.