Font Registry
In-memory registry mapping a String key (as stored on io.ak1.drawbox.domain.model.Element.Text.fontFamilyKey) to a Compose FontFamily. The registry is process-wide and intentionally non-persistent — hosts re-register their custom families on app launch, which keeps the SDK free of font-asset bundling and version skew.
Three built-in keys (sans, serif, mono) are pre-registered to Compose's platform defaults so an embedder that does nothing special still gets readable text.
Lookups for unknown keys fall back to sans and log a hint (the OSS SDK doesn't bundle a logger so the warning is best-effort via println).
Web targets (WASM + Kotlin/JS browser) — bundled-font caveat
On web targets, Compose renders through Skia-WASM, which bundles a single default font face. The generic FontFamily.SansSerif, FontFamily.Serif, and FontFamily.Monospace instances all resolve to that one bundled face at glyph time, so sans / serif / mono blocks render identically. This is a Skia-WASM limitation downstream of the SDK, not a bug in the registry.
To differentiate the built-in keys on web, register real fonts via Compose Multiplatform Resources at app launch:
controller.registerFont(BuiltinFontFamilyKeys.SANS, FontFamily(Font(Res.font.inter_Regular)))
controller.registerFont(BuiltinFontFamilyKeys.SERIF, FontFamily(Font(Res.font.crimsonText_Regular)))
controller.registerFont(BuiltinFontFamilyKeys.MONO, FontFamily(Font(Res.font.jetBrainsMono_Regular)))The registry emits a one-shot dev-console warning per unresolved key on web to make the issue visible during development. See #89.
SVG export is unaffected — the exporter emits font-family="sans" etc. as attributes, and the browser picks a system font when the SVG is opened.
Functions
Resolve key to a FontFamily. Falls back to the registered default (DEFAULT_FONT_FAMILY_KEY) when key is unknown. Returns FontFamily.SansSerif when even the default is missing — that's only possible if a host explicitly removed it (e.g. via clear).