Text styles

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

Text, the text styles of the theme, drawn by isolenText, the text styles of the theme, drawn by isolen

The five presets read the current theme:

PresetSizeFaceColour
ui::bodytext_pxface_uitext
ui::captionsmall_pxface_uitext_soft
ui::headhead_pxface_boldtext
ui::dimtext_pxface_uitext_dim
ui::monotext_pxface_monotext_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));
}

Last updated 23 October 2026