flash-font
A high-performance Rust library for caching font metadata in a SQLite database. Designed for quick scanning of font directories and fast retrieval of font paths by their family names.
Features
- Blazing Fast Scanning: Uses
walkdirfor parallel directory traversal. - Efficient Metadata Extraction: Utilizes memory-mapped files (
memmap2) andttf-parserfor high-performance font analysis. - Smart Synchronization: Only parses new or modified font files. Stale database entries are automatically cleaned up.
- Database Backend: Powered by SQLite and Diesel for reliable, indexed storage.
Usage
Add this to your Cargo.toml:
[]
= "0.1"
= "1.2"
Example: Updating the Database and Searching
use ;
use Utf8Path;
Architecture
- Scanner: Recursively scans the target directory for supported font files.
- Cleaner: Compares disk files with database records, removing orphans and identifying new files.
- Parser: Extracts font family names in parallel using multiple threads and memory mapping.
- Database: Stores mappings between file paths and family names in a normalized SQLite schema.
License
MIT OR Apache-2.0