std :: gui::gui_text
Struct std::GuiTextLayout
struct GuiTextLayout {
struct Vec<struct GuiTextGlyph> glyphs;
struct Vec<struct GuiTextLine> lines;
const ?&GuiTypeface face;
float size;
float width;
float height;
float lineHeight;
float ascent;
float maxWidth;
unsigned long textLen;
}Text broken into lines and positioned: word wrap at spaces and hyphens (anywhere for CJK, and inside words too long for a line), hard breaks at '\n', tabs to 4-space stops, alignment within maxWidth. Also maps between positions and byte offsets for carets/selection.
Fields
widest line
lines * lineHeight
as given (0 = no wrapping)
Methods
§
void build(
const &GuiTypeface face,
float size,
[]const char text,
float maxWidth,
int align,
)source · definition(Re)builds the layout of text[0..len) — 'len' may be (unsigned long)-1 for a NUL-terminated string. maxWidth <= 0: no wrapping. align: GUI_TEXT_LEFT/CENTER/RIGHT within maxWidth (or the widest line).
The byte offset whose caret position is nearest (x, y) (layout coordinates).
The caret's position for byte offset 'pos': x, the line's top, its height.
The line holding byte offset 'pos'.
= drop()