pub trait TextStyleExtwhere
Self: Sized,{
Show 13 methods
// Required method
fn get_text_style_data(&mut self) -> &mut TextStyleData;
// Provided methods
fn text_style(self, data: TextStyleData) -> Self { ... }
fn color(self, color: impl Into<Fill>) -> Self { ... }
fn text_align(self, text_align: impl Into<TextAlign>) -> Self { ... }
fn font_size(self, font_size: impl Into<FontSize>) -> Self { ... }
fn font_family(self, font_family: impl Into<Cow<'static, str>>) -> Self { ... }
fn font_slant(self, font_slant: impl Into<FontSlant>) -> Self { ... }
fn font_weight(self, font_weight: impl Into<FontWeight>) -> Self { ... }
fn font_width(self, font_width: impl Into<FontWidth>) -> Self { ... }
fn text_height(self, text_height: impl Into<TextHeightBehavior>) -> Self { ... }
fn text_overflow(self, text_overflow: impl Into<TextOverflow>) -> Self { ... }
fn text_shadow(self, text_shadow: impl Into<TextShadow>) -> Self { ... }
fn text_decoration(self, text_decoration: impl Into<TextDecoration>) -> Self { ... }
}Expand description
Methods for styling the text rendered by an element and inherited by its children.
Required Methods§
Sourcefn get_text_style_data(&mut self) -> &mut TextStyleData
fn get_text_style_data(&mut self) -> &mut TextStyleData
Returns a mutable reference to the element’s text style data.
Provided Methods§
Sourcefn text_style(self, data: TextStyleData) -> Self
fn text_style(self, data: TextStyleData) -> Self
Replace all of the element’s text style data at once. See TextStyleData.
Sourcefn text_align(self, text_align: impl Into<TextAlign>) -> Self
fn text_align(self, text_align: impl Into<TextAlign>) -> Self
Set the horizontal alignment of the text. See TextAlign.
Sourcefn font_size(self, font_size: impl Into<FontSize>) -> Self
fn font_size(self, font_size: impl Into<FontSize>) -> Self
Set the text size in pixels. See FontSize.
Sourcefn font_family(self, font_family: impl Into<Cow<'static, str>>) -> Self
fn font_family(self, font_family: impl Into<Cow<'static, str>>) -> Self
Add a font family to try, in order of preference.
Sourcefn font_slant(self, font_slant: impl Into<FontSlant>) -> Self
fn font_slant(self, font_slant: impl Into<FontSlant>) -> Self
Set the slant (style) of the font. See FontSlant.
Sourcefn font_weight(self, font_weight: impl Into<FontWeight>) -> Self
fn font_weight(self, font_weight: impl Into<FontWeight>) -> Self
Set the thickness of the font. See FontWeight.
Sourcefn font_width(self, font_width: impl Into<FontWidth>) -> Self
fn font_width(self, font_width: impl Into<FontWidth>) -> Self
Set the horizontal width of the font. See FontWidth.
Sourcefn text_height(self, text_height: impl Into<TextHeightBehavior>) -> Self
fn text_height(self, text_height: impl Into<TextHeightBehavior>) -> Self
Set how the leading of the first and last lines is handled. See TextHeightBehavior.
Sourcefn text_overflow(self, text_overflow: impl Into<TextOverflow>) -> Self
fn text_overflow(self, text_overflow: impl Into<TextOverflow>) -> Self
Set how text that does not fit its bounds is truncated. See TextOverflow.
Sourcefn text_shadow(self, text_shadow: impl Into<TextShadow>) -> Self
fn text_shadow(self, text_shadow: impl Into<TextShadow>) -> Self
Add a shadow cast behind the text. See TextShadow.
Sourcefn text_decoration(self, text_decoration: impl Into<TextDecoration>) -> Self
fn text_decoration(self, text_decoration: impl Into<TextDecoration>) -> Self
Set a line drawn through, under or over the text. See TextDecoration.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.