ltk::theme

Module font_registry

Source
Expand description

Runtime font registry: families → (weight, style) → fontdue::Font.

The registry is the live, loaded-in-memory counterpart of the theme’s fonts block (super::FontFamilyDef). It is built once at theme load time by calling FontRegistry::from_families, then handed to the render backends as an Arc<FontRegistry> so they can resolve specific sources on demand without re-reading TTFs from disk.

§Resolution order

FontRegistry::resolve looks up a family / weight / style triple with the following precedence:

  1. Exact (family, weight, style) match.
  2. Same family and style, weight closest to the request (absolute diff).
  3. Same family, any style, weight closest to the request.
  4. Walk the family’s fallbacks chain, recursing into each fallback family with the original weight/style.

When nothing matches, FontRegistry::resolve returns None; callers fall back to the canvas’ system font.

Structs§

  • Composite key identifying a single font source within a family.
  • A loaded font registry: the theme’s declared families materialised into live fontdue::Font handles, indexed by family id / weight / style.

Enums§