Trait Renderer

pub trait Renderer: Renderer {
    type Font: Copy + PartialEq;
    type Paragraph: Paragraph<Font = Self::Font> + 'static;
    type Editor: Editor<Font = Self::Font> + 'static;

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

    // Required methods
    fn default_font(&self) -> Self::Font;
    fn default_size(&self) -> Pixels;
    fn fill_paragraph(
        &mut self,
        text: &Self::Paragraph,
        position: Point,
        color: Color,
        clip_bounds: Rectangle,
    );
    fn fill_editor(
        &mut self,
        editor: &Self::Editor,
        position: Point,
        color: Color,
        clip_bounds: Rectangle,
    );
    fn fill_text(
        &mut self,
        text: Text<String, Self::Font>,
        position: Point,
        color: Color,
        clip_bounds: Rectangle,
    );
}
Available on crate feature advanced only.
Expand description

A renderer capable of measuring and drawing Text.

Required Associated Constants§

const MONOSPACE_FONT: Self::Font

A monospace font.

It may be used by devtools.

const ICON_FONT: Self::Font

The icon font of the backend.

const CHECKMARK_ICON: char

The char representing a ✔ icon in the ICON_FONT.

const ARROW_DOWN_ICON: char

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

Required Associated Types§

type Font: Copy + PartialEq

The font type used.

type Paragraph: Paragraph<Font = Self::Font> + 'static

The Paragraph of this Renderer.

type Editor: Editor<Font = Self::Font> + 'static

The Editor of this Renderer.

Required Methods§

fn default_font(&self) -> Self::Font

Returns the default Self::Font.

fn default_size(&self) -> Pixels

Returns the default size of Text.

fn fill_paragraph( &mut self, text: &Self::Paragraph, position: Point, color: Color, clip_bounds: Rectangle, )

Draws the given Paragraph at the given position and with the given Color.

fn fill_editor( &mut self, editor: &Self::Editor, position: Point, color: Color, clip_bounds: Rectangle, )

Draws the given Editor at the given position and with the given Color.

fn fill_text( &mut self, text: Text<String, Self::Font>, position: Point, color: Color, clip_bounds: Rectangle, )

Draws the given Text at the given position and with the given Color.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl Renderer for ()

§

const MONOSPACE_FONT: Font = Font::MONOSPACE

§

const ICON_FONT: Font = Font::DEFAULT

§

const CHECKMARK_ICON: char = '0'

§

const ARROW_DOWN_ICON: char = '0'

§

type Font = Font

§

type Paragraph = ()

§

type Editor = ()

§

fn default_font(&self) -> <() as Renderer>::Font

§

fn default_size(&self) -> Pixels

§

fn fill_paragraph( &mut self, _paragraph: &<() as Renderer>::Paragraph, _position: Point, _color: Color, _clip_bounds: Rectangle, )

§

fn fill_editor( &mut self, _editor: &<() as Renderer>::Editor, _position: Point, _color: Color, _clip_bounds: Rectangle, )

§

fn fill_text( &mut self, _paragraph: Text, _position: Point, _color: Color, _clip_bounds: Rectangle, )

Source§

impl Renderer for Renderer

Source§

const MONOSPACE_FONT: Font = Font::MONOSPACE

Source§

const ICON_FONT: Font

Source§

const CHECKMARK_ICON: char = '\u{f00c}'

Source§

const ARROW_DOWN_ICON: char = '\u{e800}'

Source§

type Font = Font

Source§

type Paragraph = Paragraph

Source§

type Editor = Editor

Source§

fn default_font(&self) -> <Renderer as Renderer>::Font

Source§

fn default_size(&self) -> Pixels

Source§

fn fill_paragraph( &mut self, text: &<Renderer as Renderer>::Paragraph, position: Point, color: Color, clip_bounds: Rectangle, )

Source§

fn fill_editor( &mut self, editor: &<Renderer as Renderer>::Editor, position: Point, color: Color, clip_bounds: Rectangle, )

Source§

fn fill_text( &mut self, text: Text, position: Point, color: Color, clip_bounds: Rectangle, )

Source§

impl Renderer for Renderer

Source§

const MONOSPACE_FONT: Font = Font::MONOSPACE

Source§

const ICON_FONT: Font

Source§

const CHECKMARK_ICON: char = '\u{f00c}'

Source§

const ARROW_DOWN_ICON: char = '\u{e800}'

Source§

type Font = Font

Source§

type Paragraph = Paragraph

Source§

type Editor = Editor

Source§

fn default_font(&self) -> <Renderer as Renderer>::Font

Source§

fn default_size(&self) -> Pixels

Source§

fn fill_paragraph( &mut self, text: &<Renderer as Renderer>::Paragraph, position: Point, color: Color, clip_bounds: Rectangle, )

Source§

fn fill_editor( &mut self, editor: &<Renderer as Renderer>::Editor, position: Point, color: Color, clip_bounds: Rectangle, )

Source§

fn fill_text( &mut self, text: Text, position: Point, color: Color, clip_bounds: Rectangle, )

Source§

impl<A, B> Renderer for Renderer<A, B>
where B: Renderer<Font = <A as Renderer>::Font, Paragraph = <A as Renderer>::Paragraph, Editor = <A as Renderer>::Editor>, A: Renderer,

Source§

const MONOSPACE_FONT: <Renderer<A, B> as Renderer>::Font = A::MONOSPACE_FONT

Source§

const ICON_FONT: <Renderer<A, B> as Renderer>::Font = A::ICON_FONT

Source§

const CHECKMARK_ICON: char = A::CHECKMARK_ICON

Source§

const ARROW_DOWN_ICON: char = A::ARROW_DOWN_ICON

Source§

type Font = <A as Renderer>::Font

Source§

type Paragraph = <A as Renderer>::Paragraph

Source§

type Editor = <A as Renderer>::Editor

Source§

fn default_font(&self) -> <Renderer<A, B> as Renderer>::Font

Source§

fn default_size(&self) -> Pixels

Source§

fn fill_paragraph( &mut self, text: &<Renderer<A, B> as Renderer>::Paragraph, position: Point, color: Color, clip_bounds: Rectangle, )

Source§

fn fill_editor( &mut self, editor: &<Renderer<A, B> as Renderer>::Editor, position: Point, color: Color, clip_bounds: Rectangle, )

Source§

fn fill_text( &mut self, text: Text<String, <Renderer<A, B> as Renderer>::Font>, position: Point, color: Color, clip_bounds: Rectangle, )

Implementors§