From 2e3d6381a47c65ec5eb4fa51a1f99421b5d040b4 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Wed, 27 May 2026 17:33:31 +0200 Subject: [PATCH] fix(ui): e-ink block char position in default-font path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In GxEPDDisplay::print(), the 0xDB fallback block was drawn at cy - 8*scale, which assumed the Lemon baseline convention (cy = original_y + 8*scale). For the default GFX font fontAscender returns 0, so cy = original_y (top of cell) — the block landed 16 px above the character on e-ink (scale=2). Fix: draw at cy (top of cell) for the non-Lemon path. Also remove the unused forceNextRefreshFull() virtual from DisplayDriver — it was added based on a wrong hypothesis (partial refresh ghosting) and was never wired into endFrame(). Co-Authored-By: Claude Sonnet 4.6 --- src/helpers/ui/DisplayDriver.h | 1 - src/helpers/ui/GxEPDDisplay.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/helpers/ui/DisplayDriver.h b/src/helpers/ui/DisplayDriver.h index 07a53b1b..3eeb1b6b 100644 --- a/src/helpers/ui/DisplayDriver.h +++ b/src/helpers/ui/DisplayDriver.h @@ -34,7 +34,6 @@ public: virtual int getLineHeight() const { return 8; } // pixel rows per text line virtual void setLemonFont(bool) { } // no-op; overridden by displays that support Lemon virtual bool isLemonFont() const { return false; } - // Layout helpers — derived from font metrics and screen size. // Use these instead of hardcoded pixel values so layouts adapt to any display. int lineStep() const { return getLineHeight() + 2; } // row pitch: text + gap diff --git a/src/helpers/ui/GxEPDDisplay.cpp b/src/helpers/ui/GxEPDDisplay.cpp index c61ba3f2..7b1f1352 100644 --- a/src/helpers/ui/GxEPDDisplay.cpp +++ b/src/helpers/ui/GxEPDDisplay.cpp @@ -196,7 +196,9 @@ void GxEPDDisplay::print(const char* str) { if ((uint8_t)*p == 0xDB) { int cx = display.getCursorX(); int cy = display.getCursorY(); - display.fillRect(cx, cy - 8 * sc, 5 * sc, 8 * sc, _curr_color); + // Default GFX font: cursor is top-left of cell (fontAscender=0), so cy=original_y. + // Draw block at cy (not cy-8*sc — that formula assumes Lemon's baseline offset). + display.fillRect(cx, cy, 5 * sc, 8 * sc, _curr_color); display.setCursor(cx + 6 * sc, cy); } else { char tmp[2] = {*p, 0};