Expand description
Typography scale used by the default theme.
Designed around the Sora typeface (Google Fonts). If Sora is not installed on the system, ltk falls back to Liberation Sans / DejaVu Sans; glyph metrics will differ slightly but the scale still reads correctly.
Two scales coexist: the historic px constants (H0 through
BODY_XS) for code that wants a frozen pixel size, and the new
responsive scale (h0, h1, …, body_xs) that returns
viewport-relative crate::Length values clamped to the same px
range that used to be the constant. Call sites can mix freely:
.size( typography::H2 ) still resolves to Length::px( 24.0 ) via
From<f32>, while .size( typography::h2() ) scales with the
surface’s smaller dimension.
Constants§
- See
H0. Px size of running body text. - See
H0. Px size of small (secondary) body text. - See
H0. Px size of the smallest (caption) text. - Frozen px sizes for the typographic scale, largest (
H0, a display heading) to smallest (BODY_XS, fine print).H0…H3are the heading ramp;BODYis running text, withBODY_S/BODY_XSfor secondary and caption text. Each is the px size; for sizes that scale with the surface use the responsiveh0…body_xsfunctions instead. - See
H0. Px size of the second-largest heading level. - See
H0. Px size of the third heading level. - See
H0. Px size of the fourth heading level. - Interlineado (line-height) multiplier recommended by the kit. Apply as
size * LINE_HEIGHTwhen laying out multi-line text blocks.
Functions§
- Responsive counterparts of the px constants: each returns a
Lengththat scales with the surface’s smaller dimension (vmin) and is clamped to a sensible px range, so the same level reads correctly from a portrait phone to a 4K desktop. Same hierarchy as the constants —h0the largest display heading down tobody_xsthe smallest caption. Largest display heading: scales as 5% ofvmin, clamped to32..=80px.