feat: dynamic font-adaptive layout and Lemon font icon support for SH1106

- Add getCharWidth()/getLineHeight() virtual methods to DisplayDriver so
  all layout math adapts to whatever font is active
- Fix Lemon font baseline offset from +8 to +6 (cap height, not FONT_ASCENT)
- Add LemonIcons.h with Private Use Area glyph table; U+E03B mute icon
  rendered via drawLemonChar icon lookup
- FullscreenMsgView: compute wrap width and visible lines dynamically from
  display font metrics instead of hardcoded constants
- SettingsScreen and MessagesScreen: replace hardcoded ITEM_H/VISIBLE with
  members computed at render() time from getLineHeight()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-16 13:27:34 +02:00
parent b8ac4245cf
commit 24c8dcad72
6 changed files with 131 additions and 77 deletions

View File

@@ -27,6 +27,8 @@ public:
virtual void drawRect(int x, int y, int w, int h) = 0;
virtual void drawXbm(int x, int y, const uint8_t* bits, int w, int h) = 0;
virtual uint16_t getTextWidth(const char* str) = 0;
virtual int getCharWidth() const { return 6; } // advance width of a typical character (xAdvance for monospace)
virtual int getLineHeight() const { return 8; } // pixel rows per line (cell height, not just glyph height)
virtual void drawTextCentered(int mid_x, int y, const char* str) { // helper method (override to optimise)
int w = getTextWidth(str);
setCursor(mid_x - w/2, y);