pub struct TextStyle {Show 15 fields
pub color: Hsla,
pub font_family: SharedString,
pub font_features: FontFeatures,
pub font_fallbacks: Option<FontFallbacks>,
pub font_size: AbsoluteLength,
pub line_height: DefiniteLength,
pub font_weight: FontWeight,
pub font_style: FontStyle,
pub background_color: Option<Hsla>,
pub underline: Option<UnderlineStyle>,
pub strikethrough: Option<StrikethroughStyle>,
pub white_space: WhiteSpace,
pub text_overflow: Option<TextOverflow>,
pub text_align: TextAlign,
pub line_clamp: Option<usize>,
}Expand description
The properties that can be used to style text in GPUI
Fields§
§color: HslaThe color of the text
font_family: SharedStringThe font family to use
font_features: FontFeaturesThe font features to use
font_fallbacks: Option<FontFallbacks>The fallback fonts to use
font_size: AbsoluteLengthThe font size to use, in pixels or rems.
line_height: DefiniteLengthThe line height to use, in pixels or fractions
font_weight: FontWeightThe font weight, e.g. bold
font_style: FontStyleThe font style, e.g. italic
background_color: Option<Hsla>The background color of the text
underline: Option<UnderlineStyle>The underline style of the text
strikethrough: Option<StrikethroughStyle>The strikethrough style of the text
white_space: WhiteSpaceHow to handle whitespace in the text
text_overflow: Option<TextOverflow>The text should be truncated if it overflows the width of the element
text_align: TextAlignHow the text should be aligned within the element
line_clamp: Option<usize>The number of lines to display before truncating the text
Implementations§
Trait Implementations§
Source§impl From<&TextStyle> for HighlightStyle
impl From<&TextStyle> for HighlightStyle
Source§impl From<TextStyle> for HighlightStyle
impl From<TextStyle> for HighlightStyle
Source§impl From<TextStyleRefinement> for TextStylewhere
Option<Hsla>: Clone,
Option<SharedString>: Clone,
Option<FontFeatures>: Clone,
Option<FontFallbacks>: Clone,
Option<AbsoluteLength>: Clone,
Option<DefiniteLength>: Clone,
Option<FontWeight>: Clone,
Option<FontStyle>: Clone,
Option<UnderlineStyle>: Clone,
Option<StrikethroughStyle>: Clone,
Option<WhiteSpace>: Clone,
Option<TextOverflow>: Clone,
Option<TextAlign>: Clone,
Option<usize>: Clone,
impl From<TextStyleRefinement> for TextStylewhere
Option<Hsla>: Clone,
Option<SharedString>: Clone,
Option<FontFeatures>: Clone,
Option<FontFallbacks>: Clone,
Option<AbsoluteLength>: Clone,
Option<DefiniteLength>: Clone,
Option<FontWeight>: Clone,
Option<FontStyle>: Clone,
Option<UnderlineStyle>: Clone,
Option<StrikethroughStyle>: Clone,
Option<WhiteSpace>: Clone,
Option<TextOverflow>: Clone,
Option<TextAlign>: Clone,
Option<usize>: Clone,
Source§fn from(value: TextStyleRefinement) -> Self
fn from(value: TextStyleRefinement) -> Self
Converts to this type from the input type.
Source§impl Refineable for TextStylewhere
Option<Hsla>: Clone,
Option<SharedString>: Clone,
Option<FontFeatures>: Clone,
Option<FontFallbacks>: Clone,
Option<AbsoluteLength>: Clone,
Option<DefiniteLength>: Clone,
Option<FontWeight>: Clone,
Option<FontStyle>: Clone,
Option<UnderlineStyle>: Clone,
Option<StrikethroughStyle>: Clone,
Option<WhiteSpace>: Clone,
Option<TextOverflow>: Clone,
Option<TextAlign>: Clone,
Option<usize>: Clone,
impl Refineable for TextStylewhere
Option<Hsla>: Clone,
Option<SharedString>: Clone,
Option<FontFeatures>: Clone,
Option<FontFallbacks>: Clone,
Option<AbsoluteLength>: Clone,
Option<DefiniteLength>: Clone,
Option<FontWeight>: Clone,
Option<FontStyle>: Clone,
Option<UnderlineStyle>: Clone,
Option<StrikethroughStyle>: Clone,
Option<WhiteSpace>: Clone,
Option<TextOverflow>: Clone,
Option<TextAlign>: Clone,
Option<usize>: Clone,
type Refinement = TextStyleRefinement
Source§fn refine(&mut self, refinement: &Self::Refinement)
fn refine(&mut self, refinement: &Self::Refinement)
Applies the given refinement to this instance, modifying it in place. Read more
Source§fn refined(self, refinement: Self::Refinement) -> Self
fn refined(self, refinement: Self::Refinement) -> Self
Returns a new instance with the refinement applied, equivalent to cloning
self and calling
refine on it.Source§fn is_superset_of(&self, refinement: &Self::Refinement) -> bool
fn is_superset_of(&self, refinement: &Self::Refinement) -> bool
Returns
true if this instance would contain all values from the refinement. Read moreSource§fn subtract(&self, refinement: &Self::Refinement) -> Self::Refinement
fn subtract(&self, refinement: &Self::Refinement) -> Self::Refinement
Returns a refinement that represents the difference between this instance and the given
refinement. 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().