Canvasity.measure_text

Measure the width in pixels of a line of text.

The measured width is the advance width, which includes the side bearings of the first and last glyphs. However, text as drawn may go outside this (e.g., due to glyphs that spill beyond their nominal widths or stroked text with wide lines). Measurements ignore the current transform. If the text pointer is null, or the font has not been set yet, or the last setting of it was unsuccessful, this returns zero.

Parameters

text const(char)*

Null-terminated UTF-8 string to measure.

Return Value

Type: float

Width of the text in pixels. FUTURE: more metrics, use a font API in another package

Meta