pub trait Renderer: Renderer {
    type Font: Default + Clone;

    const ICON_FONT: Self::Font;
    const CHECKMARK_ICON: char;
    const ARROW_DOWN_ICON: char;

    fn default_size(&self) -> u16;
    fn measure(
        content: &str,
        size: u16,
        font: Self::Font,
        bounds: Size
    ) -> (f32, f32); fn hit_test(
        contents: &str,
        size: f32,
        font: Self::Font,
        bounds: Size,
        point: Point,
        nearest_only: bool
    ) -> Option<Hit>; fn fill_text(&mut self, text: Text<'_, Self::Font>); fn measure_width(&self, content: &str, size: u16, font: Self::Font) -> f32 { ... } }
Expand description

A renderer capable of measuring and drawing Text.

Required Associated Types§

The font type used.

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 in the given bounds and returns the minimum boundaries that can fit the contents.

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.

Draws the given Text.

Provided Methods§

Measures the width of the text as if it were laid out in a single line.