ui::TextMetrics¶
Header: winui/render/Text.hpp.
What a TextMeasurer reports for a run of text: its extent, where its first baseline sits and how many lines it took. Converts to a Size (the extent), so code that only needs the box reads .width and .height or assigns it to a Size.
Example:
const ui::TextStyle style{.font_size = 14.0f};
const ui::TextMetrics metrics = measurer.measure("Hello", style);
const ui::Size box = metrics; // width x height
const float ascent = metrics.baseline;
width¶
The widest line's width, in DIPs.
height¶
The height of all lines together, in DIPs.
baseline¶
From the top of the box to the first line's baseline, in DIPs.
line_count¶
How many lines the text took; 1 for a single line, empty text included.
size¶
The extent, width x height.