feat: Add custom font selection from SD card

Allow users to select custom fonts (.epdfont files) from the
/.crosspoint/fonts/ directory on the SD card for EPUB/TXT reading.

Features:
- New FontSelectionActivity for browsing and selecting fonts
- SdFont and SdFontFamily classes for loading fonts from SD card
- Dynamic font reloading without device reboot
- Reader cache invalidation when font changes
- Hash-based font ID generation for proper cache management

The custom fonts use the .epdfont binary format which supports:
- 2-bit antialiasing for smooth text rendering
- Efficient on-demand glyph loading with LRU cache
- Memory-optimized design for ESP32-C3 constraints
This commit is contained in:
Eunchurn Park
2026-01-18 18:46:23 +09:00
parent 21277e03eb
commit 68ce6db291
16 changed files with 1968 additions and 82 deletions

View File

@@ -14,6 +14,9 @@ class EpdFontFamily {
const EpdFontData* getData(Style style = REGULAR) const;
const EpdGlyph* getGlyph(uint32_t cp, Style style = REGULAR) const;
// Check if bold variant is available (for synthetic bold decision)
bool hasBold() const { return bold != nullptr; }
private:
const EpdFont* regular;
const EpdFont* bold;
@@ -22,3 +25,10 @@ class EpdFontFamily {
const EpdFont* getFont(Style style) const;
};
// Global typedef for use outside class scope (needed by SdFontFamily and GfxRenderer)
using EpdFontStyle = EpdFontFamily::Style;
constexpr EpdFontStyle REGULAR = EpdFontFamily::REGULAR;
constexpr EpdFontStyle BOLD = EpdFontFamily::BOLD;
constexpr EpdFontStyle ITALIC = EpdFontFamily::ITALIC;
constexpr EpdFontStyle BOLD_ITALIC = EpdFontFamily::BOLD_ITALIC;