[−][src]Enum druid::text::Attribute
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)
The FontWeight
.
TextColor(KeyOrValue<Color>)
The foreground color of the text.
Style(FontStyle)
The FontStyle
; either regular or italic.
Underline(bool)
Underline.
Descriptor(KeyOrValue<FontDescriptor>)
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
Auto Trait Implementations
impl RefUnwindSafe for Attribute
[src]
impl Send for Attribute
[src]
impl Sync for Attribute
[src]
impl Unpin for Attribute
[src]
impl UnwindSafe for Attribute
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,