Skip to main content

TextStyle

Struct TextStyle 

Source
pub struct TextStyle {
Show 30 fields pub color: Option<Color>, pub font_size: Option<Points>, pub font_weight: Option<u16>, pub line_height: Option<Points>, pub text_align: Option<TextAlign>, pub text_align_physical: bool, pub text_indent: Option<Points>, pub text_indent_em: Option<f32>, pub font_family: Option<FontFamily>, pub italic: Option<bool>, pub letter_spacing: Option<Points>, pub letter_spacing_em: Option<f32>, pub line_height_em: Option<f32>, pub font_size_em: Option<f32>, pub line_height_multiple: Option<f32>, pub decoration: Option<TextDecoration>, pub decoration_style: Option<DecorationStyle>, pub decoration_thickness: Option<Points>, pub underline_offset: Option<Points>, pub decoration_color: Option<Color>, pub transform: Option<TextTransform>, pub shadow_color: Option<Color>, pub shadow_offset: Option<Point<Points>>, pub shadow_radius: Option<Points>, pub font_variant: Option<FontVariant>, pub writing_direction: Option<bool>, pub align_vertical: Option<Percentage>, pub placeholder_color: Option<Color>, pub selection_color: Option<Color>, pub caret_color: Option<Color>,
}
Expand description

Text properties as written on a node; unset values are inherited from the enclosing text.

Fields§

§color: Option<Color>

Foreground color.

§font_size: Option<Points>

Font size.

§font_weight: Option<u16>

Font weight, 100..=900.

§line_height: Option<Points>

Line height.

§text_align: Option<TextAlign>

Block alignment (only meaningful on a text block).

§text_align_physical: bool

Whether text_align’s left or right is a side (left, right), kept right to left, rather than the start or the end (start, end), which right to left is the other side.

§text_indent: Option<Points>

How far the first line of each paragraph starts from the leading edge (textIndent); None inherits. A negative value is 0: the first line does not hang into the margin.

§text_indent_em: Option<f32>

The same in ems of this node’s font size ("2em"); overrides text_indent when set after it.

§font_family: Option<FontFamily>

Font family; None inherits (the system font at the root).

§italic: Option<bool>

Italic (fontStyle).

§letter_spacing: Option<Points>

Extra space between characters.

§letter_spacing_em: Option<f32>

Extra space between characters in ems of this node’s font size ("0.05em"); overrides letter_spacing when set after it.

§line_height_em: Option<f32>

A line-height length relative to this node’s font size (em or a percentage), resolved before inheritance.

§font_size_em: Option<f32>

The font size relative to the inherited font size ("0.875em", "87.5%"), resolved before inheritance; overrides font_size.

§line_height_multiple: Option<f32>

Line height as a multiple of the font size ("1.5"), inherited as a multiple.

§decoration: Option<TextDecoration>

Underline / strikethrough.

§decoration_style: Option<DecorationStyle>

textDecorationStyle.

§decoration_thickness: Option<Points>

textDecorationThickness.

§underline_offset: Option<Points>

textUnderlineOffset: below the baseline.

§decoration_color: Option<Color>

Color of the decoration lines; the text color by default.

§transform: Option<TextTransform>

Case transform.

§shadow_color: Option<Color>

The text shadow’s color (textShadow, text-shadow-*: its widest layer’s).

§shadow_offset: Option<Point<Points>>

The text shadow’s offset.

§shadow_radius: Option<Points>

The text shadow’s blur radius.

§font_variant: Option<FontVariant>

fontVariant.

§writing_direction: Option<bool>

writingDirection: right to left (Some(true)), left to right, or from the content (None, auto).

§align_vertical: Option<Percentage>

textAlignVertical: where text shorter than its box sits, 0% top (auto, top), 50% center, 100% bottom.

§placeholder_color: Option<Color>

placeholderColor: an input’s placeholder (not inherited).

§selection_color: Option<Color>

selectionColor: an input’s or a selectable text’s selection highlight (not inherited).

§caret_color: Option<Color>

caretColor: an input’s caret (not inherited).

Implementations§

Source§

impl TextStyle

Source

pub fn shadow(&self) -> Option<TextShadow>

The text shadow these properties describe, if any. Like NSShadow, an offset or radius without a color uses black at a third of opacity.

Trait Implementations§

Source§

impl Clone for TextStyle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for TextStyle

Source§

impl Debug for TextStyle

Source§

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

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

impl Default for TextStyle

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for TextStyle

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TextStyle

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> 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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.