Skip to content

ui::TextLayoutRun

Header: winui/render/TextLayout.hpp.

One run of same-formatted text in a TextLayout paragraph, with the formatting of any enclosing spans already folded in.

Example:

ui::TextLayoutRun bold{"Important: ", ui::TextStyle{.weight = ui::FontWeight::Bold}};
ui::TextLayoutRun link{"read more", {}, ui::Color::from_argb(0xFF0066CC), 0}; // tag 0
ui::TextLayoutParagraph paragraph{{bold, link}};

Field Type Default
text std::string UTF-8 text of the run; a \n inside it is a hard line break.
style TextStyle Font, size, weight, italic, decorations and character spacing. Its alignment and wrapping are ignored (the layout's options decide those).
color std::optional<Color> Unset draws in the layout's default foreground.
tag std::optional<std::size_t> The caller's own id for the run, carried to hit testing (tag_at()), such as a hyperlink index; unset (the default) is none.