Font.measureText

Measure text string, return accumulated widths[] (distance to end of n-th character), returns number of measured chars.

Supports Tab character processing and processing of menu item labels like '&File'.

class Font
int
measureText
(
const dchar[] text
,
ref int[] widths
,,
int tabSize = 4
,
int tabOffset = 0
,
uint textFlags = 0
)

Parameters

text dchar[]

text string to measure

widths int[]

output buffer to put measured widths (widthsi will be set to cumulative widths text[0..i], see also _textSizeBuffer description)

maxWidth int

maximum width to measure - measure is stopping if max width is reached (pass MAX_WIDTH_UNSPECIFIED to measure all characters)

tabSize int

tabulation size, in number of spaces

tabOffset int

when string is drawn not from left position, use to move tab stops left/right

textFlags uint

TextFlag bit set - to control underline, hotkey label processing, etc...

Return Value

Type: int

number of characters measured (may be less than text.length if maxWidth is reached)

Meta