pub struct TextStyle<F> {Show 14 fields
pub color: Rgba,
pub font_family: F,
pub font_size: f32,
pub font_weight: u16,
pub font_style: FontStyle,
pub letter_spacing: f32,
pub line_height: Length,
pub white_space: WhiteSpace,
pub word_break: WordBreak,
pub overflow_wrap: OverflowWrap,
pub text_align: TextAlign,
pub text_decoration: TextDecoration,
pub vertical_align: VerticalAlign,
pub max_lines: u32,
}Expand description
Fully resolved, inherited typography of one node: everything a host needs to measure text
exactly as it paints it. F is the family: a ResolvedFamily into the store while layout
keeps it per node (ResolvedTextStyle), a borrowed &str when handed to a TextMeasurer.
Fields§
§color: Rgba§font_family: FCSS font-family list as authored; empty = the host’s default UI font.
font_size: f32Logical points, finite and >= 0.
font_weight: u16CSS weight (100..=900 once a host clamps it).
font_style: FontStyle§letter_spacing: f32Extra advance after every character, logical points.
line_height: LengthPoints = absolute; percent = unit-less multiplier × 100 of font_size; auto = normal.
white_space: WhiteSpace§word_break: WordBreak§overflow_wrap: OverflowWrap§text_align: TextAlign§text_decoration: TextDecoration§vertical_align: VerticalAlign§max_lines: u32Maximum painted lines (0 = unlimited); measured height never exceeds them.
Implementations§
Source§impl<F> TextStyle<F>
impl<F> TextStyle<F>
Sourcepub fn map_family<'s, G>(&'s self, f: impl FnOnce(&'s F) -> G) -> TextStyle<G>
pub fn map_family<'s, G>(&'s self, f: impl FnOnce(&'s F) -> G) -> TextStyle<G>
The same style with the family mapped to another representation.
Sourcepub fn wraps(&self) -> bool
pub fn wraps(&self) -> bool
false for white-space: nowrap | pre: lines break only at \n, never at max_width.
Sourcepub fn line_height_points(&self) -> Option<f32>
pub fn line_height_points(&self) -> Option<f32>
The line height in points, None for normal (the font’s own metrics).
Source§impl<F: PartialEq> TextStyle<F>
impl<F: PartialEq> TextStyle<F>
Sourcepub fn measure_eq(&self, other: &Self) -> bool
pub fn measure_eq(&self, other: &Self) -> bool
true when both styles measure identically: every field except paint-only color,
floats compared by bits (so NaN never forces endless re-measurement).