Text styles
ui::text_style is the size, face, colour, tracking, alignment and wrapping of one run.


In the galleryTexttextTypographytypography
The five presets read the current theme:
| Preset | Size | Face | Colour |
|---|---|---|---|
ui::body | text_px | face_ui | text |
ui::caption | small_px | face_ui | text_soft |
ui::head | head_px | face_bold | text |
ui::dim | text_px | face_ui | text_dim |
ui::mono | text_px | face_mono | text_soft |
Chaining then overrides one property at a time with size, in, ink (which takes a hex string such as "#fff"), tracked, aligned and wraps.
A run without wraps is elided with a mark when it does not fit its box. wraps(n) breaks it onto at most n lines, and zero means no limit.
text_styles.cpp
#include "isolenui/ui/ui.h"
// the five presets read the theme's faces and sizes, chaining overrides one
// property at a time without rebuilding the whole style by hand
static void byline(ui::ctx* u)
{
ui::text(u, "isolen ui", ui::head(u));
ui::text(u, "a declarative element tree over a backend neutral gfx device",
ui::body(u).size(16.0f).tracked(0.2f));
ui::text(u, "v0.1", ui::dim(u).aligned(text_font_right));
ui::text(u, "GFX_BACKEND_VULKAN", ui::mono(u).wraps(2u));
}