MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / begin

Method begin

src/SdCardFontSystem.cpp:18–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16} // namespace
17
18void SdCardFontSystem::begin(GfxRenderer& renderer) {
19 registry_.discover();
20
21 // Register this system as the SD font ID resolver in settings.
22 // Uses a static trampoline since CrossPointSettings stores a plain function pointer.
23 SETTINGS.sdFontIdResolver = [](void* ctx, const char* familyName, uint8_t fontSizeEnum) -> int {
24 return static_cast<SdCardFontSystem*>(ctx)->resolveFontId(familyName, fontSizeEnum);
25 };
26 SETTINGS.sdFontResolverCtx = this;
27
28 // If user has a saved SD font selection, load it
29 if (SETTINGS.sdFontFamilyName[0] != '\0') {
30 const auto* family = registry_.findFamily(SETTINGS.sdFontFamilyName);
31 if (family) {
32 if (manager_.loadFamily(*family, renderer, fontSizeEnumFromSettings())) {
33 LOG_DBG("SDFS", "Loaded SD card font family: %s", SETTINGS.sdFontFamilyName);
34 } else {
35 LOG_ERR("SDFS", "Failed to load SD font family: %s (clearing)", SETTINGS.sdFontFamilyName);
36 SETTINGS.sdFontFamilyName[0] = '\0';
37 }
38 } else {
39 LOG_DBG("SDFS", "SD font family not found on card: %s (clearing)", SETTINGS.sdFontFamilyName);
40 SETTINGS.sdFontFamilyName[0] = '\0';
41 }
42 }
43
44 LOG_DBG("SDFS", "SD font system ready (%d families discovered)", registry_.getFamilyCount());
45}
46
47void SdCardFontSystem::ensureLoaded(GfxRenderer& renderer) {
48 // If the web server (or another task) installed/deleted fonts, re-discover.

Callers 13

buildFontFamilySettingFunction · 0.45
getSettingsListFunction · 0.45
removeServerMethod · 0.45
addCredentialMethod · 0.45
removeCredentialMethod · 0.45
findCredentialMethod · 0.45
addBookMethod · 0.45
updateBookMethod · 0.45
removeByPathMethod · 0.45
updatePathMethod · 0.45
pruneMissingMethod · 0.45
setupDisplayAndFontsFunction · 0.45

Calls 6

fontSizeEnumFromSettingsFunction · 0.85
discoverMethod · 0.80
resolveFontIdMethod · 0.80
findFamilyMethod · 0.80
loadFamilyMethod · 0.80
getFamilyCountMethod · 0.80

Tested by

no test coverage detected