pub struct TextStyle {Show 22 fields
pub color: Hsla,
pub vn_text_paint: Option<Arc<VnTextPaint>>,
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>,
pub letter_spacing: Pixels,
pub word_spacing: Pixels,
pub overflow_wrap: OverflowWrap,
pub word_break: WordBreak,
pub hyphens: Hyphens,
pub text_shadow: Vec<TextShadow>,
}Expand description
The properties that can be used to style text in GPUI
Fields§
§color: HslaThe color of the text
vn_text_paint: Option<Arc<VnTextPaint>>Background clipped to transparent glyphs in this text scope.
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
letter_spacing: PixelsExtra space after each typographic character unit — CSS
letter-spacing. Already resolved to pixels: em-relative tracking is
a function of the font size, which the caller has and this does not.
word_spacing: PixelsExtra space after each word separator — CSS word-spacing.
overflow_wrap: OverflowWrapvue-native fork: CSS overflow-wrap. Initial normal, as in CSS.
word_break: WordBreakvue-native fork: CSS word-break.
hyphens: Hyphensvue-native fork: CSS hyphens.
text_shadow: Vec<TextShadow>vue-native fork: CSS text-shadow, first on top.
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<Arc<VnTextPaint>>: 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,
Option<Pixels>: Clone,
Option<OverflowWrap>: Clone,
Option<WordBreak>: Clone,
Option<Hyphens>: Clone,
Option<Vec<TextShadow>>: Clone,
impl From<TextStyleRefinement> for TextStylewhere
Option<Hsla>: Clone,
Option<Arc<VnTextPaint>>: 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,
Option<Pixels>: Clone,
Option<OverflowWrap>: Clone,
Option<WordBreak>: Clone,
Option<Hyphens>: Clone,
Option<Vec<TextShadow>>: Clone,
Source§fn from(value: TextStyleRefinement) -> Self
fn from(value: TextStyleRefinement) -> Self
Source§impl Refineable for TextStylewhere
Option<Hsla>: Clone,
Option<Arc<VnTextPaint>>: 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,
Option<Pixels>: Clone,
Option<OverflowWrap>: Clone,
Option<WordBreak>: Clone,
Option<Hyphens>: Clone,
Option<Vec<TextShadow>>: Clone,
impl Refineable for TextStylewhere
Option<Hsla>: Clone,
Option<Arc<VnTextPaint>>: 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,
Option<Pixels>: Clone,
Option<OverflowWrap>: Clone,
Option<WordBreak>: Clone,
Option<Hyphens>: Clone,
Option<Vec<TextShadow>>: Clone,
type Refinement = TextStyleRefinement
Source§fn refine(&mut self, refinement: &Self::Refinement)
fn refine(&mut self, refinement: &Self::Refinement)
Source§fn refined(self, refinement: Self::Refinement) -> Self
fn refined(self, refinement: Self::Refinement) -> Self
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
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
impl StructuralPartialEq for TextStyle
Auto Trait Implementations§
impl Forget for TextStyle
impl Freeze for TextStyle
impl Move for TextStyle
impl RefUnwindSafe for TextStyle
impl Send for TextStyle
impl Sync for TextStyle
impl Unpin for TextStyle
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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 more