Skip to main content

TextStyleExt

Trait TextStyleExt 

Source
pub trait TextStyleExt: Sized {
Show 20 methods // Required method fn text_style_data_mut(&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 letter_spacing(self, letter_spacing: impl Into<LetterSpacing>) -> Self { ... } fn font_feature(self, font_feature: impl Into<FontFeature>) -> Self { ... } fn font_tabular(self) -> Self { ... } fn font_small_caps(self) -> Self { ... } fn font_slashed_zero(self) -> Self { ... } fn font_fractions(self) -> Self { ... } fn font_no_ligatures(self) -> 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_shadow(self, text_shadow: impl Into<TextShadow>) -> Self { ... } fn text_shadows( self, text_shadows: impl IntoIterator<Item = 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 text_style_data_mut(&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 letter_spacing(self, letter_spacing: impl Into<LetterSpacing>) -> Self

Set the space between letters, in pixels. See LetterSpacing.

Source

fn font_feature(self, font_feature: impl Into<FontFeature>) -> Self

Add an OpenType font feature.

Source

fn font_tabular(self) -> Self

Every digit shares the same width, so changing numbers do not shift the layout.

Source

fn font_small_caps(self) -> Self

Lowercase letters render as small capitals.

Source

fn font_slashed_zero(self) -> Self

Zero renders with a slash or dot to tell it apart from the letter O.

Source

fn font_fractions(self) -> Self

Sequences like 1/2 render as fractions.

Source

fn font_no_ligatures(self) -> Self

Disable standard ligatures like fi or the joined => of coding fonts.

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_shadow(self, text_shadow: impl Into<TextShadow>) -> Self

Add a shadow cast behind the text, replacing inherited shadows. See TextShadow.

Source

fn text_shadows( self, text_shadows: impl IntoIterator<Item = TextShadow>, ) -> Self

Replace the text shadows. An empty list clears inherited shadows.

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

Implementations on Foreign Types§

Source§

impl TextStyleExt for SelectableText

Implementors§