mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-28 07:48:13 +00:00
feat(ui/clock): stacked big-digit clock on portrait e-ink
On a tall portrait e-ink panel the clock and lock screens wasted most of the vertical space on a small inline "HH:MM". Render HH and MM on two lines in a new size-4 font (built-in GFX scaled 7×, ~42×56 px) so the digits roughly double in height and fill the narrow width. Wide panels (OLED, landscape e-ink) keep the classic single-line size-2 layout. - New shared drawClockTime() helper used by both the Clock home page and the lock screen; returns the y below the time block so the date and dashboard rows flow beneath it. - GxEPDDisplay: size 4 = built-in font × BIG_TEXT_SCALE (7); getCharWidth / getLineHeight / setTextSize handle it; fontAscender stays 0 (built-in is top-left origin). - Centre the big digits on their visible glyph width — the built-in font advances 6 px per char but the glyph is 5 px wide, so getTextWidth over- reports by one trailing column and the digits would sit ~half a column left of centre. AM/PM rendered one size larger (size 2). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -141,6 +141,12 @@ void GxEPDDisplay::setTextSize(int sz) {
|
||||
// Size 3 always uses FreeSans18pt for large headings.
|
||||
int sc = scale();
|
||||
switch (sz) {
|
||||
case 4:
|
||||
// Huge clock digits: built-in font scaled up. Cursor stays top-left
|
||||
// (fontAscender returns 0 for the built-in font), so layout maths is plain.
|
||||
display.setFont(NULL);
|
||||
display.setTextSize(BIG_TEXT_SCALE);
|
||||
break;
|
||||
case 3:
|
||||
display.setFont(&FreeSans18pt7b);
|
||||
display.setTextSize(1);
|
||||
|
||||
Reference in New Issue
Block a user