pub struct TextStyle {
pub font_family: Option<String>,
pub font_size: f32,
pub bold: bool,
pub italic: bool,
pub color: [u8; 4],
pub letter_spacing: f32,
pub line_height: f32,
pub max_width: f32,
}Expand description
Builder-style text style for OxiUI widgets.
Wraps the upstream oxitext::TextStyle with additional per-glyph
attributes (bold, italic, color, letter spacing) that OxiUI layers on
top.
Fields§
§font_family: Option<String>Font family name, if any.
font_size: f32Font size in pixels-per-em.
bold: boolBold weight.
italic: boolItalic slant.
color: [u8; 4]Foreground RGBA color.
letter_spacing: f32Additional horizontal spacing between glyphs, in pixels.
line_height: f32Line height multiplier (1.0 = natural).
max_width: f32Maximum line width for wrapping (0 = no wrap).
Implementations§
Source§impl TextStyle
impl TextStyle
Sourcepub fn new(size: f32) -> Self
pub fn new(size: f32) -> Self
Create a new style with the given font size and sensible defaults.
Sourcepub fn letter_spacing(self, spacing: f32) -> Self
pub fn letter_spacing(self, spacing: f32) -> Self
Set the additional letter spacing in pixels.
Sourcepub fn line_height(self, height: f32) -> Self
pub fn line_height(self, height: f32) -> Self
Set the line height multiplier.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextStyle
impl RefUnwindSafe for TextStyle
impl Send for TextStyle
impl Sync for TextStyle
impl Unpin for TextStyle
impl UnsafeUnpin for TextStyle
impl UnwindSafe for TextStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more