pub trait FontFaceEngine: Send + Sync {
// Required methods
fn prepare(&self, ready: Box<dyn FnOnce(Result<(), String>) + Send>);
fn load(
&self,
type_: GlyphIDType,
data: FontData,
weight: u16,
) -> Option<Box<dyn FontFaceShaper>>;
}Expand description
Loads font files as FontFaceShapers.
Required Methods§
Sourcefn prepare(&self, ready: Box<dyn FnOnce(Result<(), String>) + Send>)
fn prepare(&self, ready: Box<dyn FnOnce(Result<(), String>) + Send>)
Gets the engine ready to load, if it isn’t yet, and then calls
ready with whether it is: before returning, or later from any
thread. It may be called again, before or after ready was called.
Sourcefn load(
&self,
type_: GlyphIDType,
data: FontData,
weight: u16,
) -> Option<Box<dyn FontFaceShaper>>
fn load( &self, type_: GlyphIDType, data: FontData, weight: u16, ) -> Option<Box<dyn FontFaceShaper>>
Loads a font, a variable font at the OpenType weight, once
prepare reported the engine ready: None when data isn’t a font
the engine can read. The shaper may keep data (the response’s
bytes) instead of copying it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".