Skip to main content

Text

Struct Text 

Source
pub struct Text<Content = String, Font = Font> {
    pub content: Content,
    pub bounds: Size,
    pub size: Pixels,
    pub line_height: LineHeight,
    pub font: Font,
    pub align_x: Alignment,
    pub align_y: Vertical,
    pub shaping: Shaping,
    pub wrapping: Wrapping,
    pub hint_factor: Option<f32>,
}
Expand description

A paragraph.

Fields§

§content: Content

The content of the paragraph.

§bounds: Size

The bounds of the paragraph.

§size: Pixels

The size of the Text in logical pixels.

§line_height: LineHeight

The line height of the Text.

§font: Font

The font of the Text.

§align_x: Alignment

The horizontal alignment of the Text.

§align_y: Vertical

The vertical alignment of the Text.

§shaping: Shaping

The Shaping strategy of the Text.

§wrapping: Wrapping

The Wrapping strategy of the Text.

§hint_factor: Option<f32>

The scale factor that may be used to internally scale the layout calculation of the Paragraph and leverage metrics hinting.

Effectively, this defines the “base” layout that will be used for linear scaling.

If None, hinting will be disabled and subpixel positioning will be performed.

Implementations§

Source§

impl<Content, Font> Text<Content, Font>
where Font: Copy,

Source

pub fn with_content<T>(&self, content: T) -> Text<T, Font>

Returns a new Text replacing only the content with the given value.

Source§

impl<Content, Font> Text<Content, Font>
where Content: AsRef<str>, Font: Copy,

Source

pub fn as_ref(&self) -> Text<&str, Font>

Returns a borrowed version of Text.

Trait Implementations§

Source§

impl<Content: Clone, Font: Clone> Clone for Text<Content, Font>

Source§

fn clone(&self) -> Text<Content, Font>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Content: Debug, Font: Debug> Debug for Text<Content, Font>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<Content: Copy, Font: Copy> Copy for Text<Content, Font>

Auto Trait Implementations§

§

impl<Content, Font> Freeze for Text<Content, Font>
where Content: Freeze, Font: Freeze,

§

impl<Content, Font> RefUnwindSafe for Text<Content, Font>
where Content: RefUnwindSafe, Font: RefUnwindSafe,

§

impl<Content, Font> Send for Text<Content, Font>
where Content: Send, Font: Send,

§

impl<Content, Font> Sync for Text<Content, Font>
where Content: Sync, Font: Sync,

§

impl<Content, Font> Unpin for Text<Content, Font>
where Content: Unpin, Font: Unpin,

§

impl<Content, Font> UnwindSafe for Text<Content, Font>
where Content: UnwindSafe, Font: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.