Struct embedded_graphics::mono_font::MonoTextStyle[][src]

#[non_exhaustive]
pub struct MonoTextStyle<'a, C> { pub text_color: Option<C>, pub background_color: Option<C>, pub underline_color: DecorationColor<C>, pub strikethrough_color: DecorationColor<C>, pub font: &'a MonoFont<'a>, }
Expand description

Style properties for text using a monospaced font.

A MonoTextStyle can be applied to a Text object to define how the text is drawn.

Because MonoTextStyle has the non_exhaustive attribute, it cannot be created using a struct literal. To create a MonoTextStyle with a given text color and transparent background, use the new method. For more complex text styles, use the MonoTextStyleBuilder.

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct {{ .. }} syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
text_color: Option<C>

Text color.

background_color: Option<C>

Background color.

underline_color: DecorationColor<C>

Underline color.

strikethrough_color: DecorationColor<C>

Strikethrough color.

font: &'a MonoFont<'a>

Font.

Implementations

impl<'a, C: PixelColor> MonoTextStyle<'a, C>[src]

pub fn new(font: &'a MonoFont<'a>, text_color: C) -> Self[src]

Creates a text style with transparent background.

pub fn is_transparent(&self) -> bool[src]

Returns true if the style is transparent.

Drawing a Text with a transparent MonoTextStyle will not draw any pixels.

Trait Implementations

impl<C: PixelColor> CharacterStyle for MonoTextStyle<'_, C>[src]

type Color = C

The color type.

fn set_text_color(&mut self, text_color: Option<Self::Color>)[src]

Sets the text color.

fn set_background_color(&mut self, background_color: Option<Self::Color>)[src]

Sets the background color.

fn set_underline_color(&mut self, underline_color: DecorationColor<Self::Color>)[src]

Sets the underline color.

fn set_strikethrough_color(
    &mut self,
    strikethrough_color: DecorationColor<Self::Color>
)
[src]

Sets the strikethrough color.

impl<'a, C: Clone> Clone for MonoTextStyle<'a, C>[src]

fn clone(&self) -> MonoTextStyle<'a, C>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a, C: Debug> Debug for MonoTextStyle<'a, C>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a, C: PixelColor> From<&'_ MonoTextStyle<'a, C>> for MonoTextStyleBuilder<'a, C>[src]

fn from(style: &MonoTextStyle<'a, C>) -> Self[src]

Performs the conversion.

impl<'a, C: PartialEq> PartialEq<MonoTextStyle<'a, C>> for MonoTextStyle<'a, C>[src]

fn eq(&self, other: &MonoTextStyle<'a, C>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &MonoTextStyle<'a, C>) -> bool[src]

This method tests for !=.

impl<C: PixelColor> TextRenderer for MonoTextStyle<'_, C>[src]

type Color = C

Color type.

fn draw_string<D>(
    &self,
    text: &str,
    position: Point,
    baseline: Baseline,
    target: &mut D
) -> Result<Point, D::Error> where
    D: DrawTarget<Color = Self::Color>, 
[src]

Draws a string. Read more

fn draw_whitespace<D>(
    &self,
    width: u32,
    position: Point,
    baseline: Baseline,
    target: &mut D
) -> Result<Point, D::Error> where
    D: DrawTarget<Color = Self::Color>, 
[src]

Draws whitespace of the given width. Read more

fn measure_string(
    &self,
    text: &str,
    position: Point,
    baseline: Baseline
) -> TextMetrics
[src]

Returns the text metrics for a string. Read more

fn line_height(&self) -> u32[src]

Returns the default line height. Read more

impl<'a, C: Copy> Copy for MonoTextStyle<'a, C>[src]

impl<'a, C> StructuralPartialEq for MonoTextStyle<'a, C>[src]

Auto Trait Implementations

impl<'a, C> !RefUnwindSafe for MonoTextStyle<'a, C>

impl<'a, C> !Send for MonoTextStyle<'a, C>

impl<'a, C> !Sync for MonoTextStyle<'a, C>

impl<'a, C> Unpin for MonoTextStyle<'a, C> where
    C: Unpin

impl<'a, C> !UnwindSafe for MonoTextStyle<'a, C>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<Src, Dst> LosslessTryInto<Dst> for Src where
    Dst: LosslessTryFrom<Src>, 
[src]

pub fn lossless_try_into(self) -> Option<Dst>[src]

Performs the conversion.

impl<Src, Dst> LossyInto<Dst> for Src where
    Dst: LossyFrom<Src>, 
[src]

pub fn lossy_into(self) -> Dst[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: Copy + PartialEq<T> + Debug + Any
[src]

pub fn inlined_clone(&self) -> T[src]

Performance hack: Clone doesn’t get inlined for Copy types in debug mode, so make it inline anyway.

fn is<T>() -> bool where
    T: Scalar
[src]

Tests if Self the same as the type T Read more

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

pub fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

pub fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).

pub fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

pub fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V