Loading...
Searching...
No Matches
fonts.c File Reference

Font registry implementation. A flat id-indexed table of loaded handles. More...

#include "ui/fonts.h"

Functions

void fonts_register (FontId id, GFont handle)
 Store a loaded font handle under its slot id.
void fonts_register_system (FontId id, GFont handle)
 Store a system font handle under its slot id, without taking ownership.
GFont fonts_get (FontId id)
 Resolve a slot id to its handle. Falls back to the system font on a miss.
void fonts_unload_all (void)
 Unload every font the app owns and clear the registry.

Variables

static GFont s_fonts [FONT_SLOTS_MAX]
 Loaded font handles, indexed by FontId.
static bool s_owned [FONT_SLOTS_MAX]
 Whether the app loaded the handle in each slot and so has to free it.

Detailed Description

Font registry implementation. A flat id-indexed table of loaded handles.

Variable Documentation

◆ s_owned

bool s_owned[FONT_SLOTS_MAX]
static

Whether the app loaded the handle in each slot and so has to free it.

A system font is parked with fonts_register_system and stays false, because unloading one the firmware owns faults.