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 shows_emoji(&self) -> bool { ... }
    fn width(&self, text: &str, font: Font) -> f32 { ... }
    fn row_air(&self) -> 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 shows_emoji(&self) -> bool

Whether emoji come out as themselves here. A terminal draws its own; painted text needs a font for them on the machine that paints it, which a server may not have.

Source

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

Source

fn row_air(&self) -> f32

How many times as tall as the line words are sized for a row is: 1 where a row is the terminal’s line, and more where Cellix lays out taller rows of its own.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§