Loading...
Searching...
No Matches
fonts.h
Go to the documentation of this file.
1
11#pragma once
12#include <pebble.h>
13
18
23typedef uint8_t FontId;
24
28#ifndef FONT_SLOTS_MAX
29#define FONT_SLOTS_MAX 24
30#endif
31
32// a FontId is a uint8_t, and the registry turns away an id past the cap, which needs one id above
33// it. at 256 the SDK's -Werror stops the build on a compare that can never be true
34#if FONT_SLOTS_MAX < 1 || FONT_SLOTS_MAX > 255
35#error "FONT_SLOTS_MAX has to be 1 to 255"
36#endif
37
58void fonts_register(FontId id, GFont handle);
59
70void fonts_register_system(FontId id, GFont handle);
71
78GFont fonts_get(FontId id);
79
86void fonts_unload_all(void);
87
GFont fonts_get(FontId id)
Resolve a slot id to its handle. Falls back to the system font on a miss.
Definition fonts.c:42
uint8_t FontId
A font slot id. The face defines its slots as 0 to FONT_SLOTS_MAX-1 and the registry treats the id as...
Definition fonts.h:23
void fonts_unload_all(void)
Unload every font the app owns and clear the registry.
Definition fonts.c:74
void fonts_register_system(FontId id, GFont handle)
Store a system font handle under its slot id, without taking ownership.
Definition fonts.c:30
void fonts_register(FontId id, GFont handle)
Store a loaded font handle under its slot id.
Definition fonts.c:18