pub struct TextFormat {
pub font_family: Option<String>,
pub font_weight: Option<u32>,
pub font_bold: Option<bool>,
pub font_italic: Option<bool>,
pub font_size: Option<f32>,
pub color: Option<[f32; 4]>,
pub features: Vec<FontFeature>,
pub hyphenation: Option<Hyphenation>,
}Expand description
Text formatting parameters for the single-line layout API.
Controls font selection, size, and text color. All fields are optional and fall back to the typesetter’s defaults (default font, default size, default text color).
Fields§
§font_family: Option<String>Font family name (e.g., “Noto Sans”, “monospace”). None means use the default font.
font_weight: Option<u32>Font weight (100-900). Overrides font_bold.
font_bold: Option<bool>Shorthand for weight 700. Ignored if font_weight is set.
font_italic: Option<bool>Italic style.
font_size: Option<f32>Font size in pixels. None means use the default size.
color: Option<[f32; 4]>Text color (RGBA, 0.0-1.0). None means use the typesetter’s text color.
features: Vec<FontFeature>Discretionary OpenType features to toggle during shaping (ligatures, small caps, tabular numerals, stylistic sets, …). Empty = font defaults.
hyphenation: Option<Hyphenation>Hyphenation (Knuth-Liang dictionary + soft-hyphen breaks) for line
wrapping. None = disabled (default); most useful for justified
prose. See Hyphenation.
Trait Implementations§
Source§impl Clone for TextFormat
impl Clone for TextFormat
Source§fn clone(&self) -> TextFormat
fn clone(&self) -> TextFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more