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

    fn default_size(&self) -> u16;
    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§

The icon font of the backend.

The char representing a ✔ icon in the ICON_FONT.

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

Required Methods§

Returns the default size of text.

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

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§