Fonts
Self-hosted web fonts, chosen by name in a theme.
Use
The addon ships a library of variable woff2 files, served from your own server. A theme page picks from it with its Base font, Heading font and Mono font fields, each a select over the library. The ui addon writes them as --font-base, --font-heading and --font-mono, which its base styles read.
Include the partial in your layout <head>, after the theme tokens:
{include '@fonts/fonts.latte'}
It emits an @font-face rule with font-display: swap for each family a theme names. The browser downloads only the faces a page uses. The font stack itself stays in your theme.
The library
Each font is a page below the addon's own page, p('@fonts'), such as p('@fonts/inter'). The page holds the woff2 file and its data: the family as title, a category (sans-serif, serif, monospace or display), tags for what the face looks like (geometric, humanist, rounded, slab, coding) and the weight range of the variable file. The file is a managed page file, served at /@fonts/inter/inter.woff2, and /@fonts/inter shows a specimen.
The registry does not index addon pages, so children() runs the query over each page's stored data in memory:
{foreach p('@fonts')->children('category=monospace,sort=title') as $font}
{$font->title}
{/foreach}
A field of the @ui/font type gives the page of its family with $field->font(), such as $t->fonts->base->font() on a theme.
The picker groups the fonts by category. A field's query option narrows what it offers with the same query, so the theme's Mono font sets "query": "category=monospace" and lists only the monospace faces, and a value outside the query is rejected on save.