pub trait FontProvider {
// Required methods
fn resolve(
&self,
families: &[String],
weight: u16,
style: FontStyle,
) -> Option<FontData>;
fn by_id(&self, id: &str) -> Option<FontData>;
fn all_faces(&self) -> Vec<FontData>;
}Expand description
Resolve font bytes by family + weight + style, or by stable id.
Implementations must never access system fonts.
Required Methods§
Sourcefn resolve(
&self,
families: &[String],
weight: u16,
style: FontStyle,
) -> Option<FontData>
fn resolve( &self, families: &[String], weight: u16, style: FontStyle, ) -> Option<FontData>
Resolve by a priority-ordered family list, weight, and style.
Iterates families in order. For each family:
- Tries exact
(family, weight, style). - Falls back to the same family with any weight/style (first BTreeMap entry).
Returns None only if no registered family matches any entry in families.
Family comparison is case-insensitive.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".