Skip to main content

Measure

Trait Measure 

Source
pub trait Measure {
    // Required methods
    fn advances(&self, text: &str, font: Font) -> Rc<Vec<f32>>;
    fn in_cells(&self) -> bool;

    // Provided methods
    fn cell_pixels(&self) -> Option<(u32, u32)> { ... }
    fn width(&self, text: &str, font: Font) -> f32 { ... }
}
Expand description

Measures text, in cells, one advance per char.

Required Methods§

Source

fn advances(&self, text: &str, font: Font) -> Rc<Vec<f32>>

Source

fn in_cells(&self) -> bool

True when text sits in whole cells, so cell positions are exact.

Provided Methods§

Source

fn cell_pixels(&self) -> Option<(u32, u32)>

A cell’s size in pixels, where there are pixels.

Source

fn width(&self, text: &str, font: Font) -> f32

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§