GetTextWidth

Measure the pixel width of a text string at a given font size.

Syntax

Susano.GetTextWidth(text, size_px) -> number

Parameters

text (string): UTF-8 text to measure.

size_px (number): Font size in pixels. If 0, uses default font size.

Return(s)

number: Width in pixels. 0 if no result was available within the internal timeout.

Behavior

Enqueues a measurement request and waits briefly for the Overlay thread to compute width.

Non-drawing operation; does not affect the build buffer.

Result depends on the active Overlay font.

Example(s)

Last updated