[][src]Trait iced_native::widget::text::Renderer

pub trait Renderer: Renderer {
    type Font: Default + Copy;
    fn default_size(&self) -> u16;
fn measure(
        &self,
        content: &str,
        size: u16,
        font: Self::Font,
        bounds: Size
    ) -> (f32, f32);
fn draw(
        &mut self,
        defaults: &Self::Defaults,
        bounds: Rectangle,
        content: &str,
        size: u16,
        font: Self::Font,
        color: Option<Color>,
        horizontal_alignment: HorizontalAlignment,
        vertical_alignment: VerticalAlignment
    ) -> Self::Output; }

The renderer of a Text fragment.

Your renderer will need to implement this trait before being able to use Text in your UserInterface.

Associated Types

type Font: Default + Copy

The font type used for Text.

Loading content...

Required methods

fn default_size(&self) -> u16

Returns the default size of Text.

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

Measures the Text in the given bounds and returns the minimum boundaries that can fit the contents.

fn draw(
    &mut self,
    defaults: &Self::Defaults,
    bounds: Rectangle,
    content: &str,
    size: u16,
    font: Self::Font,
    color: Option<Color>,
    horizontal_alignment: HorizontalAlignment,
    vertical_alignment: VerticalAlignment
) -> Self::Output

Draws a Text fragment.

It receives:

Loading content...

Implementors

impl Renderer for Null[src]

type Font = Font

Loading content...