Expand description
System font discovery and locale-based preset selection.
Detects the current system locale, maps it to a FontRegion, and resolves
a prioritized list of installed fonts. On wasm, font discovery is not supported
and the find_* functions return empty results.
use system_fonts::{find_for_system_locale, FontStyle};
let (_locale, region, fonts) = find_for_system_locale(FontStyle::Sans);
println!("region={region:?}, fonts={}", fonts.len());Structs§
- Found
Font - A resolved system font entry usable by UI code.
Enums§
- Font
Preset - A preset represents a prioritized group of candidate font families.
- Font
Region - Writing system/locale region used to decide fallback priority.
- Font
Style - Font preference used when selecting system fonts.
- Found
Font Source - Font bytes source resolved from the system font database.
Functions§
- find_
for_ locale - Resolves fonts for the given locale string. On wasm, returns an empty font list.
- find_
for_ system_ locale - Resolves fonts for the current system locale. On wasm, returns an empty font list.
- find_
from_ presets - Resolves installed system fonts from presets, ordered by priority.
- presets_
for_ region - Returns the default preset priority list for a region (highest priority first).
- region_
from_ locale - Maps a locale string (BCP-47 or POSIX style) to a
FontRegion. - system_
locale - Returns the current system locale string (e.g.
"ko-KR","en-US"), orNoneon wasm.