[][src]Trait embedded_text::utils::font_ext::FontExt

pub trait FontExt {
    fn measure_line(line: &str, max_width: u32) -> LineMeasurement;
fn measure_line_nocr(line: &str, max_width: u32) -> LineMeasurement;
fn total_char_width(c: char) -> u32;
fn str_width(s: &str) -> u32;
fn str_width_nocr(s: &str) -> u32;
fn max_str_width(s: &str, max_width: u32) -> (u32, &str);
fn max_str_width_nocr(s: &str, max_width: u32) -> (u32, &str);
fn max_space_width(n: u32, max_width: u32) -> (u32, u32); }

Font extensions

Required methods

fn measure_line(line: &str, max_width: u32) -> LineMeasurement

Measures a sequence of characters in a line with a determinate maximum width.

Returns the width of the characters that fit into the given space and whether or not all of the input fits into the given space.

fn measure_line_nocr(line: &str, max_width: u32) -> LineMeasurement

This function is identical to measure_line except it does not handle carriage return characters.

fn total_char_width(c: char) -> u32

Returns the total width of the character plus the character spacing.

fn str_width(s: &str) -> u32

Measure text width

fn str_width_nocr(s: &str) -> u32

This function is identical to str_width except it does not handle carriage return characters.

fn max_str_width(s: &str, max_width: u32) -> (u32, &str)

Measures a sequence of characters in a line with a determinate maximum width.

Returns the width of the characters that fit into the given space and the processed string.

fn max_str_width_nocr(s: &str, max_width: u32) -> (u32, &str)

This function is identical to max_str_width except it does not handle carriage return characters.

fn max_space_width(n: u32, max_width: u32) -> (u32, u32)

Measures a sequence of spaces in a line with a determinate maximum width.

Returns the width of the spaces that fit into the given space and the number of spaces that fit.

Loading content...

Implementors

impl<F> FontExt for F where
    F: Font
[src]

Loading content...