TextSize (Kernel)

TextSize(sizeRect text font [maxWidth])

Analyzes the given string with the specified font to determine how much space it will take up on the screen when it’s printed. maxWidth specifies how long each line can be. If it is not specified, then 192 is assumed. It returns the bounds of the rectangle in sizeRect.

Parameters:
  • sizeRect (heapPtr) – The rectangle into which the bounds are returns.
  • text (string) – The text.
  • font (number) – The font number to use.
  • maxWidth (number) – Optional maximum pixel width.

sizeRect should be an array of 4 values. Indices 2 and 3 represent the width and height of the text.

Example:

(procedure (SomeFunc &tmp [sizeRect 4])
        (TextSize sizeRect "Hello World" 4 100)
        ; gets the bounds of "Hello World" with FONT.004 with a maximum line width of 100
)