pub struct TextStyle {
pub font_size: Option<f32>,
pub font_weight: u16,
pub italic: bool,
pub color: Option<[u8; 4]>,
pub line_height: Option<f32>,
pub letter_spacing: f32,
pub underline: bool,
pub strikethrough: bool,
}Expand description
Text rendering style for labels and headings.
All fields have sensible defaults (400-weight, upright, theme colour). Use the builder methods to produce variant styles without repeating boilerplate.
§Example
use oxiui_core::TextStyle;
let style = TextStyle::default()
.with_size(18.0)
.with_weight(600)
.with_color([0, 0, 0, 255]);Fields§
§font_size: Option<f32>Font size in points (None = use the theme default).
font_weight: u16Font weight: 100 = thin, 400 = regular, 700 = bold, 900 = black.
italic: boolWhether the text is rendered with an italic face.
color: Option<[u8; 4]>Text colour in RGBA bytes (None = use the theme default).
line_height: Option<f32>Line height multiplier (None = platform/theme default of ~1.2).
letter_spacing: f32Additional horizontal space between glyphs, in pixels (0.0 = default).
underline: boolDraw a line beneath the text.
strikethrough: boolDraw a line through the middle of the text.
Implementations§
Source§impl TextStyle
impl TextStyle
Sourcepub fn with_weight(self, weight: u16) -> Self
pub fn with_weight(self, weight: u16) -> Self
Builder: override the font weight (100–900).
Sourcepub fn with_color(self, rgba: [u8; 4]) -> Self
pub fn with_color(self, rgba: [u8; 4]) -> Self
Builder: set an explicit RGBA colour override.
Sourcepub fn with_line_height(self, multiplier: f32) -> Self
pub fn with_line_height(self, multiplier: f32) -> Self
Builder: set the line height multiplier.
Sourcepub fn with_letter_spacing(self, spacing: f32) -> Self
pub fn with_letter_spacing(self, spacing: f32) -> Self
Builder: set the additional letter spacing in pixels.
Sourcepub fn with_underline(self, underline: bool) -> Self
pub fn with_underline(self, underline: bool) -> Self
Builder: enable or disable the underline decoration.
Sourcepub fn with_strikethrough(self, strikethrough: bool) -> Self
pub fn with_strikethrough(self, strikethrough: bool) -> Self
Builder: enable or disable the strikethrough decoration.