pub trait Font: Send + Sync {
// Required methods
fn advance(&self) -> u32;
fn line_height(&self) -> u32;
fn draw_glyph(&self, ch: char, draw_pixel: &mut dyn FnMut(i32, i32));
}Expand description
Trait for custom font providers.
Consumers can implement this trait on custom font types (e.g. anti-aliased fonts,
vector text generators, external BDF/PSF font decoders, TTF parsers) and use
FontId::Dynamic or FontId::from to pass them to text styling.
Required Methods§
Sourcefn line_height(&self) -> u32
fn line_height(&self) -> u32
Vertical line height in pixels.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".