embedded_font

Struct FontTextStyleBuilder

Source
pub struct FontTextStyleBuilder<C: PixelColor> { /* private fields */ }
Expand description

Text style builder for ttf and otf fonts.

Use this builder to create [MonoTextStyle]s for [Text].

Implementations§

Source§

impl<C: PixelColor> FontTextStyleBuilder<C>

Source

pub fn new(font: Font<'static>) -> Self

Creates a new text style builder.

Source

pub fn font_size(self, font_size: u32) -> Self

Builder method used to set the font size of the style.

Source

pub fn underline(self) -> Self

Enables underline using the text color.

Source

pub fn strikethrough(self) -> Self

Enables strikethrough using the text color.

Source

pub fn text_color(self, text_color: C) -> Self

Sets the text color.

Source

pub fn background_color(self, background_color: C) -> Self

Sets the background color.

Source

pub fn underline_with_color(self, underline_color: C) -> Self

Enables underline with a custom color.

Source

pub fn strikethrough_with_color(self, strikethrough_color: C) -> Self

Enables strikethrough with a custom color.

Source

pub fn build(self) -> FontTextStyle<C>

Builds the text style.

This method can only be called after a font was set by using the font method. All other settings are optional and they will be set to their default value if they are missing.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.