Skip to main content

TextStyle

Struct TextStyle 

Source
pub struct TextStyle { /* private fields */ }
Expand description

Typography properties controlling deterministic text layout and glyph rendering.

Implementations§

Source§

impl TextStyle

Optional selection highlight helpers for TextStyle.

Source

pub const fn text_select_mode(&self) -> Option<TextSelectMode>

Returns the explicitly configured TextSelectMode on this node, if any.

§Arguments
  • &Self - Text style reference.
§Returns
  • Option<TextSelectMode> - Explicit selection mode, or None to inherit from ancestors.
Source

pub const fn get_text_select(&self) -> TextSelectMode

Returns the local TextSelectMode configured on this node (TextSelectMode::None when unset).

§Arguments
  • &Self - Text style reference.
§Returns
  • TextSelectMode - Local text selection mode.
Source

pub const fn get_selectable(&self) -> bool

Returns whether this node locally enables text selection (get_text_select() != TextSelectMode::None).

§Arguments
  • &Self - Text style reference.
§Returns
  • bool - true when this node locally configures a selectable mode.
Source

pub fn set_selectable(&mut self, selectable: bool) -> &mut Self

Sets an explicit boolean selectability flag mapped onto TextSelectMode.

§Arguments
  • &Self - Mutable text style reference.
  • bool - true maps to TextSelectMode::SelectAndCopy, false maps to TextSelectMode::None.
§Returns
  • &mut Self - Mutable text style reference for chaining.
Source

pub fn selection_color(&self) -> Option<Color>

Returns the optional custom selection highlight fill color.

§Arguments
  • &Self - Text style reference.
§Returns
  • Option<Color> - Selection highlight tint if explicitly configured.
Source§

impl TextStyle

Source

pub fn get_family(&self) -> FontFamily

Source

pub fn get_mut_family(&mut self) -> &mut FontFamily

Source

pub fn set_family(&mut self, val: FontFamily) -> &mut Self

Source

pub fn get_font_size(&self) -> f32

Source

pub fn get_mut_font_size(&mut self) -> &mut f32

Source

pub fn set_font_size(&mut self, val: f32) -> &mut Self

Source

pub fn get_weight(&self) -> FontWeight

Source

pub fn get_mut_weight(&mut self) -> &mut FontWeight

Source

pub fn set_weight(&mut self, val: FontWeight) -> &mut Self

Source

pub fn get_line_height(&self) -> f32

Source

pub fn get_mut_line_height(&mut self) -> &mut f32

Source

pub fn set_line_height(&mut self, val: f32) -> &mut Self

Source

pub fn get_letter_spacing(&self) -> f32

Source

pub fn get_mut_letter_spacing(&mut self) -> &mut f32

Source

pub fn set_letter_spacing(&mut self, val: f32) -> &mut Self

Source

pub fn get_align(&self) -> TextAlign

Source

pub fn get_mut_align(&mut self) -> &mut TextAlign

Source

pub fn set_align(&mut self, val: TextAlign) -> &mut Self

Source

pub fn get_overflow(&self) -> TextOverflow

Source

pub fn get_mut_overflow(&mut self) -> &mut TextOverflow

Source

pub fn set_overflow(&mut self, val: TextOverflow) -> &mut Self

Source

pub fn get_color(&self) -> Color

Source

pub fn get_mut_color(&mut self) -> &mut Color

Source

pub fn set_color(&mut self, val: Color) -> &mut Self

Source

pub fn get_italic(&self) -> bool

Source

pub fn get_mut_italic(&mut self) -> &mut bool

Source

pub fn set_italic(&mut self, val: bool) -> &mut Self

Source

pub fn get_underline(&self) -> bool

Source

pub fn get_mut_underline(&mut self) -> &mut bool

Source

pub fn set_underline(&mut self, val: bool) -> &mut Self

Source

pub fn get_strikethrough(&self) -> bool

Source

pub fn get_mut_strikethrough(&mut self) -> &mut bool

Source

pub fn set_strikethrough(&mut self, val: bool) -> &mut Self

Source

pub fn get_mut_text_select(&mut self) -> &mut Option<TextSelectMode>

Source

pub fn set_text_select(&mut self, val: Option<TextSelectMode>) -> &mut Self

Source

pub fn get_mut_selection_color(&mut self) -> &mut Option<Color>

Source

pub fn set_selection_color(&mut self, val: Option<Color>) -> &mut Self

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

Default typography style (14px Sans Regular, 1.4 line height).

Source§

fn default() -> Self

Creates the default UI text style.

§Returns
  • Self - Default TextStyle.
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> 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.