pub trait Text {
    const ICON_FONT: Font;
    const CHECKMARK_ICON: char;
    const ARROW_DOWN_ICON: char;

    // Required methods
    fn default_size(&self) -> f32;
    fn measure(
        &self,
        contents: &str,
        size: f32,
        font: Font,
        bounds: Size
    ) -> (f32, f32);
    fn hit_test(
        &self,
        contents: &str,
        size: f32,
        font: Font,
        bounds: Size,
        point: Point,
        nearest_only: bool
    ) -> Option<Hit>;
}
Expand description

A graphics backend that supports text rendering.

Required Associated Constants§

source

const ICON_FONT: Font

The icon font of the backend.

source

const CHECKMARK_ICON: char

The char representing a ✔ icon in the ICON_FONT.

source

const ARROW_DOWN_ICON: char

The char representing a ▼ icon in the built-in ICON_FONT.

Required Methods§

source

fn default_size(&self) -> f32

Returns the default size of text.

source

fn measure(&self, contents: &str, size: f32, font: Font, bounds: Size) -> (f32, f32)

Measures the text contents with the given size and font, returning the size of a laid out paragraph that fits in the provided bounds.

source

fn hit_test( &self, contents: &str, size: f32, font: Font, bounds: Size, point: Point, nearest_only: bool ) -> Option<Hit>

Tests whether the provided point is within the boundaries of Text laid out with the given parameters, returning information about the nearest character.

If nearest_only is true, the hit test does not consider whether the the point is interior to any glyph bounds, returning only the character with the nearest centeroid.

Implementors§