pub struct TextStyle {
pub size: f32,
pub color: Color,
pub weight: FontWeight,
pub style: FontStyle,
}Expand description
Text style for rendering.
§Examples
use presentar_core::{TextStyle, FontWeight, FontStyle, Color};
// Use default style
let default_style = TextStyle::default();
assert_eq!(default_style.size, 16.0);
assert_eq!(default_style.weight, FontWeight::Normal);
// Create custom style
let heading_style = TextStyle {
size: 24.0,
color: Color::from_hex("#1a1a1a").expect("valid hex"),
weight: FontWeight::Bold,
style: FontStyle::Normal,
};Fields§
§size: f32Font size in pixels
color: ColorText color
weight: FontWeightFont weight
style: FontStyleFont style
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TextStyle
impl<'de> Deserialize<'de> for TextStyle
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TextStyle, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TextStyle, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for TextStyle
impl Serialize for TextStyle
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for TextStyle
Auto Trait Implementations§
impl Freeze for TextStyle
impl RefUnwindSafe for TextStyle
impl Send for TextStyle
impl Sync for TextStyle
impl Unpin for TextStyle
impl UnwindSafe for TextStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more