Skip to content

Anti-aliased VLW fonts using Inter#2

Open
theNailz wants to merge 1 commit intofeature/lovyan-gfxfrom
feature/vlw-fonts
Open

Anti-aliased VLW fonts using Inter#2
theNailz wants to merge 1 commit intofeature/lovyan-gfxfrom
feature/vlw-fonts

Conversation

@theNailz
Copy link
Copy Markdown
Owner

@theNailz theNailz commented Apr 1, 2026

Summary

  • Replace bitmap fonts (1/2/4) with smooth anti-aliased VLW fonts generated from Inter Regular at 10/14/19pt
  • Font 7 (7-segment) kept as-is for clock displays
  • New fonts.h abstraction layer with setFont() helper — centralizes all font selection
  • Python generator script (scripts/generate_vlw_fonts.py) for reproducible font builds from TTF source
  • Character set: printable ASCII + degree symbol (96 glyphs)

Builds on top of the LovyanGFX migration (Keralots#37). Will be included when lovyan-gfx merges upstream.

Flash usage (on top of LovyanGFX)

Board Before After
S3 69.1% 71.5%
CYD 66.7% 68.9%
C3 65.3% 70.5%

Test plan

  • All three environments build clean
  • Flashed and verified on S3 — text renders with anti-aliased Inter font
  • Clock mode Font 7 (7-segment) still works correctly
  • Verify CYD
  • Verify C3
  • Fine-tune text positioning if needed (VLW metrics differ slightly from bitmap fonts)

Replace LovyanGFX built-in bitmap fonts (1/2/4) with smooth anti-aliased
VLW fonts generated from Inter Regular at 10/14/19pt. Font 7 (7-segment)
is kept for clock displays.

- Add Python script to generate VLW PROGMEM headers from TTF
- Create font abstraction layer (fonts.h) with setFont() helper
- Migrate all setTextFont() calls across 5 display files
- All three targets build (~70% flash with LovyanGFX)
@theNailz theNailz marked this pull request as ready for review April 1, 2026 11:57
@theNailz
Copy link
Copy Markdown
Owner Author

theNailz commented Apr 1, 2026

Looks solid overall — the VLW font pipeline and setFont abstraction are clean. Two things:

1. Type mismatch with headless PR
setFont() in fonts.h takes lgfx::LGFX_Device&, but PR #1 (headless C3) changes the global tft from LGFX_Device& to LovyanGFX& (the base class, needed for sprite polymorphism). If both PRs land, setFont(tft, ...) won't compile. The fix is simple — change the parameter to lgfx::LovyanGFX& — but worth noting so merge order doesn't bite you.

2. Font 6 → FONT_LARGE regression
One callsite previously used tft.setTextFont(compact ? 4 : 6) — Font 6 is noticeably larger than Font 4. After this PR both branches map to FONT_LARGE (Inter 19pt, which replaced Font 4). The non-compact path now uses a smaller font than before. If that layout was tight on space it might be fine, but if the larger font was intentional you'd want a FONT_XLARGE level or a bigger Inter size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant