Trait embedded_graphics::text::renderer::CharacterStyle

source ·
pub trait CharacterStyle: Clone {
    type Color: PixelColor;

    // Provided methods
    fn set_text_color(&mut self, _text_color: Option<Self::Color>) { ... }
    fn set_background_color(&mut self, _background_color: Option<Self::Color>) { ... }
    fn set_underline_color(
        &mut self,
        _underline_color: DecorationColor<Self::Color>,
    ) { ... }
    fn set_strikethrough_color(
        &mut self,
        _strikethrough_color: DecorationColor<Self::Color>,
    ) { ... }
}
Expand description

Character style.

This trait is used to modify character styles programmatically, for example, to implement rendering of text with multiple colors. Applications shouldn’t use this trait and instead use the character style types that are provided by the text renderer, like MonoTextStyle and MonoTextStyleBuilder for the integrated font support.

§Implementation notes

Text renderers don’t need to support all settings in this trait. All calls to unsupported setters should be ignored by the implementation. The trait provided empty default implementations for all setters.

Required Associated Types§

source

type Color: PixelColor

The color type.

Provided Methods§

source

fn set_text_color(&mut self, _text_color: Option<Self::Color>)

Sets the text color.

source

fn set_background_color(&mut self, _background_color: Option<Self::Color>)

Sets the background color.

source

fn set_underline_color( &mut self, _underline_color: DecorationColor<Self::Color>, )

Sets the underline color.

source

fn set_strikethrough_color( &mut self, _strikethrough_color: DecorationColor<Self::Color>, )

Sets the strikethrough color.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<C> CharacterStyle for MonoTextStyle<'_, C>
where C: PixelColor,

§

type Color = C