Skip to main content

TextMetrics

Trait TextMetrics 

Source
pub trait TextMetrics {
    // Required methods
    fn line_height(&self) -> f32;
    fn caret_x(&self, text: &str, byte: usize) -> f32;
}
Expand description

The measures of the debug UI’s font, in UI units (a UI unit is a pixel of the font).

Required Methods§

Source

fn line_height(&self) -> f32

The height of a line.

Source

fn caret_x(&self, text: &str, byte: usize) -> f32

Where the pen is before the character at byte of the one-line text, from the text’s start: the kerning before that character included, and spaces taking their room. At text.len(), it is the pen after the last character, the text’s width. byte is a character boundary of text, or its length.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§