mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
fix(ui): e-ink block char position in default-font path
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 <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,6 @@ public:
|
|||||||
virtual int getLineHeight() const { return 8; } // pixel rows per text line
|
virtual int getLineHeight() const { return 8; } // pixel rows per text line
|
||||||
virtual void setLemonFont(bool) { } // no-op; overridden by displays that support Lemon
|
virtual void setLemonFont(bool) { } // no-op; overridden by displays that support Lemon
|
||||||
virtual bool isLemonFont() const { return false; }
|
virtual bool isLemonFont() const { return false; }
|
||||||
|
|
||||||
// Layout helpers — derived from font metrics and screen size.
|
// Layout helpers — derived from font metrics and screen size.
|
||||||
// Use these instead of hardcoded pixel values so layouts adapt to any display.
|
// Use these instead of hardcoded pixel values so layouts adapt to any display.
|
||||||
int lineStep() const { return getLineHeight() + 2; } // row pitch: text + gap
|
int lineStep() const { return getLineHeight() + 2; } // row pitch: text + gap
|
||||||
|
|||||||
@@ -196,7 +196,9 @@ void GxEPDDisplay::print(const char* str) {
|
|||||||
if ((uint8_t)*p == 0xDB) {
|
if ((uint8_t)*p == 0xDB) {
|
||||||
int cx = display.getCursorX();
|
int cx = display.getCursorX();
|
||||||
int cy = display.getCursorY();
|
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);
|
display.setCursor(cx + 6 * sc, cy);
|
||||||
} else {
|
} else {
|
||||||
char tmp[2] = {*p, 0};
|
char tmp[2] = {*p, 0};
|
||||||
|
|||||||
Reference in New Issue
Block a user