Skip to main content

TextStyleExt

Trait TextStyleExt 

Source
pub trait TextStyleExt
where 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§

Source

fn get_text_style_data(&mut self) -> &mut TextStyleData

Returns a mutable reference to the element’s text style data.

Provided Methods§

Source

fn text_style(self, data: TextStyleData) -> Self

Replace all of the element’s text style data at once. See TextStyleData.

Source

fn color(self, color: impl Into<Fill>) -> Self

Paint the text with any Fill: a Color, a gradient or a shader.

Source

fn text_align(self, text_align: impl Into<TextAlign>) -> Self

Set the horizontal alignment of the text. See TextAlign.

Source

fn font_size(self, font_size: impl Into<FontSize>) -> Self

Set the text size in pixels. See FontSize.

Source

fn font_family(self, font_family: impl Into<Cow<'static, str>>) -> Self

Add a font family to try, in order of preference.

Source

fn font_slant(self, font_slant: impl Into<FontSlant>) -> Self

Set the slant (style) of the font. See FontSlant.

Source

fn font_weight(self, font_weight: impl Into<FontWeight>) -> Self

Set the thickness of the font. See FontWeight.

Source

fn font_width(self, font_width: impl Into<FontWidth>) -> Self

Set the horizontal width of the font. See FontWidth.

Source

fn text_height(self, text_height: impl Into<TextHeightBehavior>) -> Self

Set how the leading of the first and last lines is handled. See TextHeightBehavior.

Source

fn text_overflow(self, text_overflow: impl Into<TextOverflow>) -> Self

Set how text that does not fit its bounds is truncated. See TextOverflow.

Source

fn text_shadow(self, text_shadow: impl Into<TextShadow>) -> Self

Add a shadow cast behind the text. See TextShadow.

Source

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".

Implementors§