[][src]Enum druid::text::Attribute

pub enum Attribute {
    FontFamily(FontFamily),
    FontSize(KeyOrValue<f64>),
    Weight(FontWeight),
    TextColor(KeyOrValue<Color>),
    Style(FontStyle),
    Underline(bool),
    Descriptor(KeyOrValue<FontDescriptor>),
}

Attributes that can be applied to text.

Where possible, attributes are KeyOrValue types; this means you can use items defined in the theme or concrete types, where appropriate.

The easiest way to construct these attributes is via the various constructor methods, such as Attribute::size or Attribute::text_color.

Examples

use druid::text::Attribute;
use druid::{theme, Color};

let font = Attribute::font_descriptor(theme::UI_FONT);
let font_size = Attribute::size(32.0);
let explicit_color = Attribute::text_color(Color::BLACK);
let theme_color = Attribute::text_color(theme::SELECTION_COLOR);

Variants

FontFamily(FontFamily)

The font family.

FontSize(KeyOrValue<f64>)

The font size, in points.

Weight(FontWeight)
TextColor(KeyOrValue<Color>)

The foreground color of the text.

Style(FontStyle)

The FontStyle; either regular or italic.

Underline(bool)

Underline.

Implementations

impl Attribute[src]

pub fn size(size: impl Into<KeyOrValue<f64>>) -> Self[src]

Create a new font size attribute.

pub fn text_color(color: impl Into<KeyOrValue<Color>>) -> Self[src]

Create a new forground color attribute.

pub fn font_family(family: FontFamily) -> Self[src]

Create a new font family attribute.

pub fn weight(weight: FontWeight) -> Self[src]

Create a new FontWeight attribute.

pub fn style(style: FontStyle) -> Self[src]

Create a new FontStyle attribute.

pub fn underline(underline: bool) -> Self[src]

Create a new underline attribute.

pub fn font_descriptor(font: impl Into<KeyOrValue<FontDescriptor>>) -> Self[src]

Create a new FontDescriptor attribute.

Trait Implementations

impl Clone for Attribute[src]

impl Debug for Attribute[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.