pub struct RichSegment {
pub text: char,
pub bold: bool,
pub italic: bool,
pub underline: bool,
pub superscript: bool,
pub subscript: bool,
pub greek: bool,
pub color: Option<Color>,
pub font_size: Option<f32>,
pub field_em: Option<f32>,
pub rule: bool,
pub rule_dash: Option<Vec<f32>>,
}Fields§
§text: char§bold: bool§italic: bool§underline: bool§superscript: bool§subscript: bool§greek: bool§color: Option<Color>Per-segment ink color. None inherits RichText.color.
font_size: Option<f32>Per-segment base font size. None inherits RichText.font_size;
the sub/superscript ratio applies on top of the effective size.
field_em: Option<f32>Fixed advance in em (× effective font size). The glyph ink is drawn horizontally centered inside the field; the advance itself ignores glyph metrics entirely. This is what gives legend marks an exact, font-size-relative width no glyph combination could guarantee.
rule: boolRender as a horizontal rule (drawn bar) spanning the full advance
instead of a glyph — the line part of legend marks. text stays as
a fallback character for consumers that ignore the flag.
rule_dash: Option<Vec<f32>>Optional dash pattern for a rule segment, in em units. Values are multiplied by the effective segment font size at draw time.
Implementations§
Source§impl RichSegment
impl RichSegment
Sourcepub fn plain(text: char) -> Self
pub fn plain(text: char) -> Self
One plain character: all style flags off, no per-segment overrides —
color and font size inherit from the parent RichText.
Sourcepub fn rule(width_em: f32, color: Option<Color>) -> Self
pub fn rule(width_em: f32, color: Option<Color>) -> Self
A drawn horizontal rule filling a fixed width_em × font_size
advance — the line stroke of legend marks. '—' remains as the
fallback text form.