mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 15:17:37 +03:00
5.2 KiB
5.2 KiB
Comparison with Upstream (crosspoint-reader/master)
This document details the modifications and enhancements made in this fork/branch compared to the upstream master branch (https://github.com/crosspoint-reader/crosspoint-reader).
1. Custom Font Support Framework
A complete system for loading and rendering custom fonts from the SD card was implemented.
New Core Components
lib/EpdFontLoader/EpdFontLoader.{cpp,h}: A new library responsible for discovering, validating, and ensuring custom fonts are loaded into the renderer. It includes safety fallbacks to the default "Bookerly" font if a custom font fails to load.src/managers/FontManager.{cpp,h}: A singleton manager that scans the/fontsdirectory on the SD card, parses.epdfontheaders, and createsEpdFontFamilyinstances for valid fonts.lib/EpdFont/CustomEpdFont.{cpp,h}: A new font implementation that reads glyph data directly from the binary.epdfontfiles on the SD card, implementing an LRU cache for bitmaps to optimize RAM usage.src/activities/settings/FontSelectionActivity.{cpp,h}: A new UI screen allowing the user to select from available custom fonts found on the SD card.lib/EpdFont/EpdFontStyles.h: Added to define styles (Regular, Bold, Italic, BoldItalic) for better font family management.
Tooling Updates
lib/EpdFont/scripts/fontconvert.py: Significantly rewritten to generate binary.epdfontfiles with a specific 48-byte header and 13-byte glyph structures required by the new firmware reader. It fixes offset calculations that were broken in the original version.
2. EPUB Rendering & Parsing Improvements
The EPUB reader core was modified to improve stability, performance, and memory management.
lib/Epub/Epub/Section.cpp:- Removed
SDLockusage which was causing compilation issues. - Cleaned up file I/O operations and caching logic.
- Removed
lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp:- Removed
SDLockdependency. - Integrated better progress reporting and memory monitoring logs.
- Removed
lib/Epub/Epub.cpp: Enhanced error handling during book loading.lib/Epub/Epub/Page.cpp: Optimized page serialization/deserialization.
3. Graphics Renderer Enhancements
lib/GfxRenderer/GfxRenderer.{cpp,h}:- Updated to support
CustomEpdFontalongside built-in compiled headers. - Implemented font ID based lookup that seamlessly handles both built-in and dynamic custom fonts.
- Removed excessive verbose logging to improve performance in production builds.
- Updated to support
4. Application State & Settings
src/CrossPointSettings.{cpp,h}:- Added persistent storage for the selected
customFontFamily. - Updated
getReaderFontId()to resolve IDs dynamically viaEpdFontLoaderwhen a custom font is selected.
- Added persistent storage for the selected
src/main.cpp:- CRITICAL FIX: Re-enabled
verifyWakeupLongPress()to prevent the device from accidentally powering on when plugged in or bumped. - Integrated
EpdFontLoader::loadFontsFromSdinto the startup sequence.
- CRITICAL FIX: Re-enabled
5. User Interface Updates
src/activities/settings/SettingsActivity.cpp: Added the "Reader Font Family" menu option to navigate to the new font selection screen.src/activities/reader/EpubReaderActivity.cpp: Updated to use the dynamic font loading system and respect the user's custom font choice.
6. Documentation
CUSTOM_FONTS.md: Created detailed developer documentation explaining the architecture of the custom font system.FONT_CONVERSION.md: Added a user guide for converting.ttf/.otffiles to.epdfontusing the Python script.USER_GUIDE.md: Updated with a new section on Custom Fonts and how to use them.
Summary of Files Added/Modified
New Files:
CUSTOM_FONTS.mdFONT_CONVERSION.mdlib/EpdFont/CustomEpdFont.{cpp,h}lib/EpdFont/EpdFontStyles.hlib/EpdFontLoader/EpdFontLoader.{cpp,h}src/activities/settings/FontSelectionActivity.{cpp,h}src/managers/FontManager.{cpp,h}
Modified Files:
- Core Logic:
src/main.cpp,src/CrossPointSettings.{cpp,h},src/CrossPointState.cpp - UI:
src/activities/settings/SettingsActivity.{cpp,h},src/activities/reader/EpubReaderActivity.cpp,src/activities/reader/FileSelectionActivity.cpp - Rendering:
lib/GfxRenderer/GfxRenderer.{cpp,h},lib/EpdFont/EpdFont.{cpp,h} - EPUB Engine:
lib/Epub/*(various files optimized and cleaned) - Tools:
lib/EpdFont/scripts/fontconvert.py
Update: Enhanced Font Discovery & Format Support (2025-01-20)
- V1 Format Support: Added full support for the newer V1
.epdfontformat (32-byte header, uint32 offsets) used by the web-based converter (epdfont.clev.app). - V0 Format Fix: Fixed a regression in V0 font loading where the header read was truncated to 32 bytes (instead of 48), restoring support for
LibreBaskervilleand other legacy fonts. - Flexible Discovery: Updated
FontManagerto supportFamily_Style_Size(underscore-separated) naming conventions, enabling compatibility with a wider range of auto-generated filenames. - Documentation: Rewrote
FONT_CONVERSION.mdto cover both the Python script and the new web converter.