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
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]
impl<'a, C: PixelColor> MonoTextStyle<'a, C>[src]Trait Implementations
impl<C: PixelColor> CharacterStyle for MonoTextStyle<'_, C>[src]
impl<C: PixelColor> CharacterStyle for MonoTextStyle<'_, C>[src]type Color = C
type Color = CThe color type.
fn set_text_color(&mut self, text_color: Option<Self::Color>)[src]
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]
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]
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]
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]
impl<'a, C: Clone> Clone for MonoTextStyle<'a, C>[src]fn clone(&self) -> 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]
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]
impl<'a, C: Debug> Debug for MonoTextStyle<'a, C>[src]impl<'a, C: PixelColor> From<&'_ MonoTextStyle<'a, C>> for MonoTextStyleBuilder<'a, C>[src]
impl<'a, C: PixelColor> From<&'_ MonoTextStyle<'a, C>> for MonoTextStyleBuilder<'a, C>[src]fn from(style: &MonoTextStyle<'a, C>) -> Self[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]
impl<'a, C: PartialEq> PartialEq<MonoTextStyle<'a, C>> for MonoTextStyle<'a, C>[src]fn eq(&self, other: &MonoTextStyle<'a, C>) -> bool[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]
fn ne(&self, other: &MonoTextStyle<'a, C>) -> bool[src]This method tests for !=.
impl<C: PixelColor> TextRenderer for MonoTextStyle<'_, C>[src]
impl<C: PixelColor> TextRenderer for MonoTextStyle<'_, C>[src]type Color = C
type Color = CColor 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]
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]
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]
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]
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,
C: Unpin,
impl<'a, C> !UnwindSafe for MonoTextStyle<'a, C>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>, [src]
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>, [src]pub fn lossless_try_into(self) -> Option<Dst>[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]
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>, [src]pub fn lossy_into(self) -> Dst[src]
pub fn lossy_into(self) -> Dst[src]Performs the conversion.
impl<T> Same<T> for T
impl<T> Same<T> for Ttype Output = T
type Output = TShould always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>, pub fn to_subset(&self) -> Option<SS>
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
pub fn is_in_subset(&self) -> boolChecks if self is actually part of its subset T (and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SSUse with care! Same as self.to_subset but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SPThe inclusion map: converts self to the equivalent element of its superset.
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
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]
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<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,