use fission::prelude::*;
// In view setup: a run is typed content data, not an independent widget.
let tokens = &cx.view.env().theme.tokens;
let run = RichTextRun {
text: cx.tr("sync.failed"),
style: TextRunStyle {
font_size: Some(tokens.typography.body_medium_size),
color: Some(tokens.colors.error),
font_weight: Some(tokens.typography.font_weight_bold),
..Default::default()
},
semantics_label: None,
semantics_identifier: None,
spell_out: None,
};
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
font_size | Option<f32> | Font size in layout points. | Falls back to theme body size when absent. |
color | Option<IrColor> | Text color override. | Falls back to the theme's primary text color when absent. |
underline | bool | Whether the run is underlined. | Defaults to false. |
font_family | Option<String> | Font family override. | Defaults to None. |
locale | Option<String> | Locale override used during shaping. | Defaults to None. |
font_weight | Option<u16> | Font weight override. | Falls back to 400 when absent. |
font_style | TextFontStyle | Normal or italic posture. | Defaults to Normal. |
line_height | Option<f32> | Explicit line height. | Defaults to None. |
letter_spacing | Option<f32> | Additional letter spacing. | Defaults to None. |
text_scale | Option<f32> | Scale multiplier for the run. | Defaults to None, which behaves like 1.0. |
text_scaler | Option<TextScaler> | Explicit scaling policy for the run. | When absent, environment scaling applies unless legacy text_scale is set. |
background_color | Option<IrColor> | Background color behind the run. | Defaults to None. |
typography | TextTypography | Additional shaping and typography configuration. | Defaults to standard typography. |