system-fonts
System font discovery and locale-based preset selection.
This crate provides a small API to:
- Detect the system locale
- Map locale strings to a
FontRegion - Resolve a prioritized list of installed system fonts using
fontdb
It is designed to be consumed by UI toolkits (e.g. egui_system_fonts), where the caller loads
font bytes and registers them into the UI font system.
Installation
[]
= "0.1"
Usage
Detect region from locale
use ;
assert_eq!;
assert_eq!;
Resolve fonts for a specific locale
use ;
let = find_for_locale;
println!;
Resolve fonts for the current system locale
use ;
let = find_for_system_locale;
println!;
Notes
- Font resolution is best-effort: missing families are skipped.
- The internal font database is cached (loaded once per process).
FoundFont::keyis unique within a single run; do not persist it across runs.
License
MIT OR Apache-2.0