feat: runtime font switcher — Default vs Lemon in Settings > Display

- Add Lemon font (LemonFont.h, LemonIcons.h) to the standard build
  alongside the Adafruit built-in font; ~101 KB added to flash
- SH1106Display: add _use_lemon flag + setLemonFont(bool) to switch
  at runtime; print() and getTextWidth() use Lemon path when active;
  translateUTF8ToBlocks() passes UTF-8 through unchanged (Lemon supports
  full Unicode U+0020-U+04FF) vs transliterating for the default font
- DisplayDriver: add getCharWidth()/getLineHeight() virtuals (defaults 6/8);
  SH1106Display returns 5/9 for Lemon, 6/8 for default; add setLemonFont()
  no-op virtual; fix orphaned UTF-8 leading byte in drawTextEllipsized
- FullscreenMsgView: replace fixed-char-count word-wrap with pixel-accurate
  wrap using display.getTextWidth(); use getLineHeight() for spacing so
  Lemon (9 px) and default (8 px) both render correctly
- NodePrefs: add use_lemon_font field (0=default, 1=Lemon)
- SettingsScreen: add "Font" item in Display section (Default / Lemon),
  calls UITask::applyFont() on change
- UITask: add applyFont() that calls display->setLemonFont(use_lemon_font);
  called at startup (begin()) and when the setting changes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-22 09:33:35 +02:00
co-authored by Claude Sonnet 4.6
parent 72c07df8b3
commit a115916d8f
10 changed files with 1732 additions and 29 deletions
@@ -14,6 +14,7 @@ class SettingsScreen : public UIScreen {
BATT_DISPLAY,
CLOCK_SECONDS,
CLOCK_FORMAT,
FONT,
// Sound section
SECTION_SOUND,
BUZZER,
@@ -316,6 +317,10 @@ class SettingsScreen : public UIScreen {
display.print("Format");
display.setCursor(VAL_X, y);
display.print((p && p->clock_12h) ? "12h" : "24h");
} else if (item == FONT) {
display.print("Font");
display.setCursor(VAL_X, y);
display.print((p && p->use_lemon_font) ? "Lemon" : "Default");
} else if (item == DM_FILTER) {
display.print("DM");
display.setCursor(VAL_X, y);
@@ -506,6 +511,12 @@ public:
_dirty = true;
return true;
}
if (_selected == FONT && p && (left || right || enter)) {
p->use_lemon_font ^= 1;
_task->applyFont();
_dirty = true;
return true;
}
if (_selected == DM_FILTER && p && (left || right || enter)) {
p->dm_show_all = p->dm_show_all ? 0 : 1;
_dirty = true;