An open source, free program to display all LovyanGFX fonts on M5 Stack devices.
Welcome screen showing app title and version
NEW in v2.1: Comprehensive font metrics display - Shows H(height), B(baseline), C(char width), A(ascender), D(descender), and TW(text width)
This Arduino project displays over 100 different font variants across 12 families available in the LovyanGFX library (https://github.com/lovyan03/LovyanGFX) for device display using LCD, OLED, or EPD.
LovyanGFX apparently is similar to the Light and Versatile Graphics Library (LVGL) at https://lvgl.io/, but with somewhat reduced functionality and an easier learning curve.
Currently this application is bound to the M5Dial, but is structured to allow display on other M5Stack devices in the future.
When powered on, users on an M5Dial can:
-
Rotate the encoder to display sample text using different font families and the families various individual fonts that vary in size and style (italic & bold),
-
Press the bottom M5 button to cycle through some dozen sample text strings, including seven Panagrams, phrases that use all the letters of the alphabet:
- Pack my box with five dozen liquor jugs - The quick brown fox jumps over the lazy dog - Glib jocks quiz nymph to vex dwarf - Sphinx of black quartz, judge my vow - How vexingly quick daft zebras jump! - The five boxing wizards jump quickly - Jackdaws love my big sphinx of quartz.
Example: FreeMono 9pt monospace font
https://github.com/VashJuan/LovyanGFX_font_display
-
Font Family Navigation: Cycle through multiple font families including:
Default English-Only Build (7 font families):
- Built-in LGFX fonts
- Free Mono family
- Free Sans family
- Free Serif family
- Decorative fonts (Orbitron, Roboto, Satisfy, Yellowtail)
- DejaVu family
Full Build (11 font families - requires external flash):
- All English fonts (above)
- Japanese Mincho family
โ ๏ธ (excluded in default build) - Japanese Gothic family
โ ๏ธ (excluded in default build) - eFontCN family (Chinese)
โ ๏ธ (excluded in default build) - eFontJA family (Japanese)
โ ๏ธ (excluded in default build)
Example: Satisfy 24pt decorative font
-
Interactive Controls:
- Rotate encoder to cycle through all the fonts
- Press button to cycle through different sample strings of text
-
Font Metrics Display: Shows detailed typographic information for each font:
- H (Height): Total font height in pixels
- B (Baseline): Baseline offset from top
- C (Char): Standard character width
- A (Ascender): Height above baseline
- D (Descender): Height below baseline
- TW (Text Width): Width of current sample text
-
Real-time Display: Shows font family name, font name, size, metrics, and sample text
- M5Dial: M5Stack Dial device with rotary encoder and display
- Platform: Arduino M5Stack Board Manager v2.0.7 or later
- M5GFX: https://github.com/m5stack/M5GFX
- M5Unified: https://github.com/m5stack/M5Unified
This project supports two build configurations to manage memory usage:
- Environment:
m5stack-stamps3-en - Default configuration optimized for memory efficiency
- Flash Usage: ~730KB (21.8% of available 3.3MB)
- Includes: English fonts, decorative fonts (Orbitron, Roboto, etc.)
- Excludes: East Asian fonts (Japanese, Chinese, Korean) to prevent memory overflow
- Environment:
m5stack-stamps3-full - Includes: All fonts including East Asian character sets
- Flash Usage: ~7.7MB (exceeds available 3.3MB flash memory)
- Status:
โ ๏ธ Cannot be used - requires external flash storage or custom partition scheme
# Build English-only version (default)
pio run -e m5stack-stamps3-en
# Build full version (will fail due to memory constraints)
pio run -e m5stack-stamps3-full
# Upload English-only version
pio run -e m5stack-stamps3-en --target uploadThe English-only build is automatically selected as the default to ensure the application works out-of-the-box without memory issues.
The easiest way to get started is using the pre-configured VSCode workspace:
-
Prerequisites:
-
Clone and open:
git clone https://github.com/vashjuan/m5Dial_font_display.git cd LovyanGFX_font_display code LovyanGFX_M5Dial.code-workspace
-
Install recommended extensions (VSCode will prompt you):
- PlatformIO IDE
- C/C++ Extension Pack
- Code Spell Checker
-
Build and upload:
- Press
Ctrl+Shift+Pand type "PlatformIO: Build" or use the tasks:๐จ PIO Build- Build the project๐ค PIO Upload- Upload to device๐ฅ๏ธ PIO Monitor- Monitor serial output๐งน PIO Clean- Clean build files
- Press
-
Install PlatformIO:
- Install PlatformIO IDE or
- Install PlatformIO Core:
pip install platformio
-
Clone the repository:
git clone https://github.com/vashjuan/m5Dial_font_display.git cd LovyanGFX_font_display
-
Build and upload:
# Using PlatformIO CLI (builds English-only version by default) pio run --target upload # Explicitly build English-only version pio run -e m5stack-stamps3-en --target upload # Or using PlatformIO IDE # Open the project folder and click the upload button -
Monitor serial output:
pio device monitor
-
Clone this repository:
git clone https://github.com/vashjuan/m5Dial_font_display.git
-
Open project: Open
LovyanGFX_font_display.inoin Arduino IDE -
Install libraries: Install required libraries through Arduino Library Manager:
- ๐ฆ M5GFX
- ๐ฆ M5Unified
- ๐ฆ M5Dial
-
Configure: Select the M5Dial board & appropriate serial port in Arduino IDE
-
Upload: Upload to your M5Dial device ๐ค
The included LovyanGFX_M5Dial.code-workspace provides:
- ๐ง Preconfigured Tasks: Build, upload, monitor, and clean with one click
- ๐ IntelliSense: Full C++ code completion and error detection
- ๐ฏ Integrated Terminal: Direct access to PlatformIO commands
- ๐ Smart File Organization: Proper exclude patterns for build files
- โ๏ธ Code Formatting: Automatic C++ formatting and spell checking
- ๐ Extension Recommendations: Auto-prompts for required extensions
- Ctrl+Shift+P โ "PlatformIO: Build" - Build the project
- Ctrl+Shift+P โ "PlatformIO: Upload" - Upload to M5Dial
- Ctrl+Shift+P โ "PlatformIO: Serial Monitor" - View serial output
- Ctrl+Shift+P โ "Tasks: Run Task" - Access custom build tasks
LovyanGFX_font_display/
โโโ ๐ platformio.ini # PlatformIO configuration (ESP32-S3)
โโโ ๐ LovyanGFX_M5Dial.code-workspace # VSCode workspace configuration
โโโ ๐ .vscode/ # VSCode settings
โ โโโ settings.json # Editor settings
โ โโโ c_cpp_properties.json # C++ IntelliSense config
โ โโโ launch.json # Debug configuration
โ โโโ extensions.json # Recommended extensions
โโโ ๐ src/ # Source files
โ โโโ ๐ฏ LovyanGFX_font_display.ino # Main Arduino sketch
โ โโโ ๐ง encoder.cpp/hpp # Encoder handling
โ โโโ ๐จ fontmanager.cpp/hpp # Font display management
โ โโโ ๐ฑ m5dial.cpp/hpp # M5Dial device interface
โโโ ๐ lib/ # Custom libraries (if any)
โโโ ๐ include/ # Header files
โโโ ๐ imgs/ # Documentation images
โโโ ๐ README.md # This documentation
- Power on the M5Dial
- The device will display "M5 Dial Font Display v2.1.0" on startup
- Rotate the encoder to cycle through different fonts
- Press the button (at bottom of dial, embossed with "M5") to cycle through the sample texts
- Font information is displayed at the top of the screen:
- Font family and name
- Font size
- Font metrics: H=height, B=baseline, C=char width, A=ascender, D=descender, TW=text width
- Sample text is displayed using the selected font
- Serial monitor shows additional limited debug information
Example: FreeSerif 24pt serif font
Here are examples of various fonts available in the application:
![]() DejaVu 9pt |
![]() FreeMono Bold 9pt |
![]() FreeSans 9pt |
![]() DejaVu 24pt |
![]() Orbitron Light 24pt |
More font examples coming soon... |
- ๐ฏ
LovyanGFX_font_display.ino- Main Arduino sketch - ๐ง
encoder.hpp/cpp- Encoder handling class - ๐จ
fontmanager.hpp/cpp- Font display management class - ๐ฑ
m5dial.hpp/cpp- M5Dial device interface - โ๏ธ
platformio.ini- PlatformIO configuration - ๐
README.md- This documentation
๐จ FontDisplayManager (fontmanager.hpp)
โ uses
๐ฑ DeviceInterface (abstract)
โ implemented by
๐ M5DialDevice (m5dial.hpp)
โ uses
๐ง EncoderHandler (encoder.hpp)
- "Hello World!"
- "Font Demo"
- "M5Dial"
- "12345"
- "ABC abc"
- and various panagrams (see www.wikipedia.com/panagram)
The program outputs font information to the serial monitor for debugging:
- Current encoder position
- Font family name
- Font name
- Font size
The encoder implementation has been updated to use the recommended M5Stack approach:
- Direct GPIO Reading: Uses proper hardware pins (40, 41) for M5Dial encoder
- Quadrature Encoding: Implements proper encoder position tracking
- Pull-up Resistors: Correctly configured input pins with internal pull-ups
- Position Methods: Supports
getPosition(),resetPosition(), andsetPosition()
The encoder class provides a clean interface following M5Stack documentation standards:
- Initializes encoder pins during setup
- Tracks position changes with minimal overhead
- Provides reset and set position functionality for advanced use cases
This project uses automated git-based version management for consistent versioning across all builds and releases.
- Single Source of Truth: Git tags define the project version
- Build-Time Injection: Version is automatically injected during compilation
using
git describe --tags --always - No Hardcoded Versions: Source files contain no version strings - everything is derived from git state
The system automatically determines version based on git repository state:
- Exact Tag:
v2.0.1(when built from tagged commit) - Post-Release:
v2.0.1-3-g1234abc(3 commits past v2.0.1 tag) - No Tags:
1234abc(commit hash when no tags exist)
-
Prepare your changes:
git add . git commit -m "Ready for v2.0.2 release"
-
Create and push the tag:
git tag v2.0.2 git push origin main --tags
-
Build automatically uses new version:
pio run --target upload # Shows "v2.0.2" in startup message
- No manual version updates needed - git tags handle everything
- Development builds show commit distance from last release
- Branch-specific versions - different branches can have different version histories
- Version appears in:
- Device startup message:
"M5 Dial Font Display v2.0.2" - Serial output:
"=== M5 Dial Font Display v2.0.2 ===" - Build logs:
PROJECT_VERSION="v2.0.2"
- Device startup message:
For additional automation, version update scripts are available in /scripts/:
update_version.ps1(PowerShell)update_version.sh(Bash)
Note: With git-based versioning, these scripts are optional but can help with README updates.
# Clean build
pio run --target clean
# Build only
pio run
# Build and upload
pio run --target upload
# Upload filesystem (if applicable)
pio run --target uploadfs
# Monitor serial output
pio device monitor
# Build with verbose output
pio run -v
-
Enable debug output by modifying
build_flagsinplatformio.ini:build_flags = -DCORE_DEBUG_LEVEL=5 ; Set to 0-5 for different debug levels -
Use PlatformIO's built-in debugger (requires compatible hardware debugger)
- Add new fonts: Modify
fontmanager.cppto include additional LovyanGFX fonts - Change sample texts: Edit the
sampleTextsarray in the main sketch - Adjust encoder sensitivity: Modify encoder parameters in
encoder.cpp - Support other devices: Implement the
DeviceInterfacefor other M5Stack devices
John Cornelison ([email protected])
v2.1.0 - Add consistent versioning, update Welcome Screen, and add detailed font metrics. (2025-12-30)
v2.0 - Second release (2025-12-30)
v1.0 - Initial release (2025-12-16)
This project is open source. Feel free to use, modify, and distribute.
๐ Contributions are welcome! Here's how you can help:
- ๐ด Fork the repository
- ๐ฟ Create a feature branch (
git checkout -b feature/amazing-feature) - ๐พ Commit your changes (
git commit -m 'Add some amazing feature') - ๐ค Push to the branch (
git push origin feature/amazing-feature) - ๐ Open a Pull Request
- Version defined in platformio.ini - check build flags for current version
- No manual source file updates needed - version is injected at build time
- Test your changes by building:
pio run --target upload - Version displays in startup message and serial output
- Version Display: Check startup message shows correct version from build flags
- Code Style: Follow existing formatting and commenting patterns
- Testing: Verify encoder functionality and font display work correctly
- Documentation: Update README.md if adding new features
- ๐จ Add support for more M5Stack devices
- ๐ Add internationalization support
- ๐ต Add sound feedback
- โ
Add font metrics display(Completed!) - ๐ญ Add font preview animations
- ๐ Add font comparison mode
- ๐จ Add custom font loading support
๐ง Report Issues โข ๐ฌ Discussions โข ๐ Latest Release









