From fe1e0d29ce7b476a0a8de3443681a987c2e09cbb Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Fri, 17 Jul 2026 20:53:56 +0200 Subject: [PATCH] fix(display): undefined-glyph box overlapped the line above on OLED drawLemonChar()'s "y" is the top of the current text row on SH1106 (real glyphs render at y + 7 + yo + row), unlike GxEPDDisplay's version, where y IS the baseline. The undefined-glyph fallback box copied GxEPD's y - 7*sz formula verbatim during the font-unification pass, sending it 7px above the row's top edge -- into the previous line's space. Drawing it at plain y (already baseline minus the font's 7px ascent) lands it in the same relative position GxEPD's version occupies, within its own row. Co-Authored-By: Claude Sonnet 5 --- src/helpers/ui/SH1106Display.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/helpers/ui/SH1106Display.cpp b/src/helpers/ui/SH1106Display.cpp index 464201d9..57d8e28e 100644 --- a/src/helpers/ui/SH1106Display.cpp +++ b/src/helpers/ui/SH1106Display.cpp @@ -93,7 +93,13 @@ int16_t SH1106Display::drawLemonChar(int16_t x, int16_t y, uint32_t cp) { // Font glyphs come from misc-fixed 6x9 (full Latin/Greek/Cyrillic, ascent 7) — // baseline +7. The custom UI icons above keep +6, so they sit 1px higher. if (cp < MiscFixed.first || cp > MiscFixed.last) { - if (cp >= 0x20) display.fillRect(x + sz, y - 7*sz, 4*sz, 6*sz, _color); + // y here is the top of the current text row, i.e. already baseline minus + // the font's 7px ascent (see real-glyph rendering just below: y + 7 + yo + + // row) -- unlike GxEPDDisplay's drawLemonChar, where y IS the baseline and + // the box sits at y - 7*sc for the same reason. Drawing this box at plain + // `y` (not y - 7*sz) lands it in the same ascent-top position, within its + // own row instead of bleeding into the row above. + if (cp >= 0x20) display.fillRect(x + sz, y, 4*sz, 6*sz, _color); return x + 6 * sz; } const GFXglyph* g = &MiscFixedGlyphs[cp - MiscFixed.first];