TextRunStyle

TextRunStyle is the low-level style object behind RichTextRun.
Most app authors do not need to construct it directly because builder methods like .size(...), .color(...), and .weight(...) on RichTextRun are easier to read. You reach for TextRunStyle directly when you want to prepare or reuse a text style value as data.

Example

use fission::prelude::*;
let run = RichTextRun {
    text: "Important".into(),
    style: TextRunStyle {
        font_size: Some(16.0),
        color: Some(view.env.theme.tokens.colors.primary),
        underline: false,
        font_family: None,
        locale: None,
        font_weight: Some(700),
        font_style: TextFontStyle::Normal,
        line_height: None,
        letter_spacing: None,
        text_scale: None,
        background_color: None,
    },
    semantics_label: None,
    semantics_identifier: None,
    spell_out: None,
};

Field table

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.
background_color
Option<IrColor>
Background color behind the run.
Defaults to None.

Specific advice

TextRunStyle is a fully specified run style, not the cascading span style used inside nested rich-text trees. If you need inheritance-like behavior, build with rich-text spans instead of copying whole run styles around by hand.

Production checklist

For TextRunStyle, review the fields that change behavior before treating the widget as finished: font_size, color, underline, font_family, locale, font_weight. The goal is to make the product rule visible in state and actions, not hidden inside ad-hoc construction code.
If this widget appears inside an interactive flow, keep the surrounding action binding in the parent component and test that the flow still has one clear reducer path.
Check the semantics tree for the user-facing label or role that makes this widget understandable without relying only on pixels.
Add at least one component or harness test that confirms the visible text, semantic role, action dispatch, and layout constraint that matter for this widget in context.
If a screen starts repeating the same TextRunStyle setup, extract a named component around this widget. That keeps the reference API small while making product code easier to read and safer for generated code to copy.
RichTextRun, RichText, TextFontStyle, and Text.
Fission
A cross-platform, GPU-accelerated user interface framework for Rust. MIT licensed.
Copyright (c) 2026 Fission
Ready to use today. Widget APIs are expected to remain stable; some runtime and shell APIs may change before 1.0.0.
Fission 0.7.0