Fix: moved loadFontsFromSd to occur on exit from settings

This fixes a bug where the loaded IDs do not exist in accessible memory if a user only changes font size in settings with a custom font defined; as a result, re-entering a book would rerender it with the correct size but the default font.
This commit is contained in:
bean 2026-01-26 14:59:59 -05:00
parent 974b7f28b7
commit fcdb4db2fe
2 changed files with 6 additions and 3 deletions

View File

@ -76,9 +76,6 @@ void FontSelectionActivity::saveAndExit() {
SETTINGS.customFontFamily[sizeof(SETTINGS.customFontFamily) - 1] = '\0'; SETTINGS.customFontFamily[sizeof(SETTINGS.customFontFamily) - 1] = '\0';
SETTINGS.fontFamily = CrossPointSettings::FONT_CUSTOM; SETTINGS.fontFamily = CrossPointSettings::FONT_CUSTOM;
SETTINGS.saveToFile(); SETTINGS.saveToFile();
// Reload fonts to make sure the newly selected font is loaded
EpdFontLoader::loadFontsFromSd(renderer);
} }
onClose(); onClose();
} }
@ -119,5 +116,9 @@ void FontSelectionActivity::render() const {
y += 30; y += 30;
} }
// Draw help text
const auto labels = mappedInput.mapLabels("« Back", "Select", "", "");
renderer.drawButtonHints(UI_10_FONT_ID, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
renderer.displayBuffer(); renderer.displayBuffer();
} }

View File

@ -105,6 +105,8 @@ void SettingsActivity::loop() {
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) { if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
SETTINGS.saveToFile(); SETTINGS.saveToFile();
// Reload fonts to make sure the newly selected font settings are loaded
EpdFontLoader::loadFontsFromSd(renderer);
onGoHome(); onGoHome();
return; return;
} }