pub trait Font {
// Required method
unsafe fn as_bytes(&self) -> &[u8];
// Provided methods
fn is_ascii(&self) -> bool { ... }
fn line_width_ascii(&self, t: &str) -> u32 { ... }
fn line_width_utf8(&self, t: &str) -> u32 { ... }
fn char_width(&self) -> u8 { ... }
fn char_height(&self) -> u8 { ... }
fn baseline(&self) -> u8 { ... }
}Expand description
A loaded font file.
Required Methods§
Provided Methods§
Sourcefn line_width_ascii(&self, t: &str) -> u32
fn line_width_ascii(&self, t: &str) -> u32
Calculate width (in pixels) of the given ASCII text.
This function does not account for newlines.
Sourcefn line_width_utf8(&self, t: &str) -> u32
fn line_width_utf8(&self, t: &str) -> u32
Calculate width (in pixels) of the given UTF-8 text.
This function does not account for newlines.
Sourcefn char_width(&self) -> u8
fn char_width(&self) -> u8
The width (in pixels) of one glyph bounding box.
Sourcefn char_height(&self) -> u8
fn char_height(&self) -> u8
The height (in pixels) of one glyph (one line) bounding box.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".