mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
feat(eink): scale size-1 font with display orientation
Portrait mode (122px wide) matches the OLED's ~21 chars/line with a 1× font. Landscape mode (250px wide) was using the same small 6×8 font, leaving text physically tiny and the wide display underutilised. Size 1 now scales by orientation: 1× (6×8 / Lemon 5×10) in portrait, 2× (12×16 / Lemon 10×20) in landscape. Size 2 stays at 12×16 and size 3 at FreeSans18pt in both orientations — their layout Y-positions are hardcoded so they cannot be scaled without a full layout refactor. fontAscender() updated to accept a scale parameter; Lemon ascender becomes 8×scale (8px portrait, 16px landscape) to keep top-of-cell coordinate semantics consistent with the rest of the UI code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -68,11 +68,20 @@ public:
|
||||
// 1 = FreeSans9pt (lineH=16, charW≈9)
|
||||
// 2 = FreeSansBold12pt (lineH=20, charW≈12)
|
||||
// 3 = FreeSans18pt (lineH=28, charW≈17)
|
||||
// Size 1: GFX built-in 6×8 (default) or Lemon 5×10 bitmap font — matches OLED metrics.
|
||||
// Size 2: GFX built-in scaled 12×16 bitmap font.
|
||||
// Size 3: FreeSans18pt proportional font for large headings.
|
||||
int getCharWidth() const override { return _text_sz == 3 ? 17 : _text_sz == 2 ? 12 : (_use_lemon ? 5 : 6); }
|
||||
int getLineHeight() const override { return _text_sz == 3 ? 28 : _text_sz == 2 ? 16 : (_use_lemon ? 10 : 8); }
|
||||
// Size 1 scales with orientation (portrait 1×, landscape 2×); size 2 is always 12×16;
|
||||
// size 3 is FreeSans18pt (~17×28). Landscape = width >= height.
|
||||
int getCharWidth() const override {
|
||||
int sc = (width() >= height()) ? 2 : 1;
|
||||
if (_text_sz == 3) return 17;
|
||||
if (_text_sz == 2) return 12;
|
||||
return (_use_lemon ? 5 : 6) * sc;
|
||||
}
|
||||
int getLineHeight() const override {
|
||||
int sc = (width() >= height()) ? 2 : 1;
|
||||
if (_text_sz == 3) return 28;
|
||||
if (_text_sz == 2) return 16;
|
||||
return (_use_lemon ? 10 : 8) * sc;
|
||||
}
|
||||
void setLemonFont(bool enabled) override { _use_lemon = enabled; }
|
||||
|
||||
bool begin();
|
||||
|
||||
Reference in New Issue
Block a user