Struct fontdue::layout::TextStyle

source ·
pub struct TextStyle<'a, U: Copy + Clone = ()> {
    pub text: &'a str,
    pub px: f32,
    pub font_index: usize,
    pub user_data: U,
}
Expand description

A style description for a segment of text.

Fields§

§text: &'a str

The text to layout.

§px: f32

The scale of the text in pixel units. The units of the scale are pixels per Em unit.

§font_index: usize

The font to layout the text in.

§user_data: U

Additional user data to associate with glyphs produced by this text style.

Implementations§

source§

impl<'a> TextStyle<'a>

source

pub fn new(text: &'a str, px: f32, font_index: usize) -> TextStyle<'a>

source§

impl<'a, U: Copy + Clone> TextStyle<'a, U>

source

pub fn with_user_data( text: &'a str, px: f32, font_index: usize, user_data: U ) -> TextStyle<'a, U>

Auto Trait Implementations§

§

impl<'a, U> Freeze for TextStyle<'a, U>
where U: Freeze,

§

impl<'a, U> RefUnwindSafe for TextStyle<'a, U>
where U: RefUnwindSafe,

§

impl<'a, U> Send for TextStyle<'a, U>
where U: Send,

§

impl<'a, U> Sync for TextStyle<'a, U>
where U: Sync,

§

impl<'a, U> Unpin for TextStyle<'a, U>
where U: Unpin,

§

impl<'a, U> UnwindSafe for TextStyle<'a, U>
where U: UnwindSafe,

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> 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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.