#[non_exhaustive]pub struct ParagraphStyle {
pub family: Cow<'static, str>,
pub size_px: f32,
pub line_height: f32,
pub color: Color,
pub align: TextAlign,
pub max_width: Option<f32>,
}Expand description
How a whole paragraph is set; Spans override parts of it.
Sizes and widths are in physical pixels: multiply logical sizes by the display’s scale factor, and lay out again when it changes.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.family: Cow<'static, str>CSS-style family list, for example "Inter, sans-serif".
size_px: f32Font size in pixels per em.
line_height: f32Line height as a multiple of the font size.
color: ColorText color.
align: TextAlignLine alignment.
max_width: Option<f32>Width lines wrap at, in pixels; None breaks only at explicit newlines.
Implementations§
Source§impl ParagraphStyle
impl ParagraphStyle
Sourcepub fn new(size_px: f32) -> Self
pub fn new(size_px: f32) -> Self
White monospace text of size_px pixels, 1.3 line height, start-aligned, unwrapped.
Sourcepub fn with_family(self, family: impl Into<Cow<'static, str>>) -> Self
pub fn with_family(self, family: impl Into<Cow<'static, str>>) -> Self
The style with the family list family.
Sourcepub fn with_color(self, color: Color) -> Self
pub fn with_color(self, color: Color) -> Self
The style with text color color.
Sourcepub fn with_align(self, align: TextAlign) -> Self
pub fn with_align(self, align: TextAlign) -> Self
The style with line alignment align.
Sourcepub fn with_line_height(self, line_height: f32) -> Self
pub fn with_line_height(self, line_height: f32) -> Self
The style with a line height of line_height times the font size.
Sourcepub fn with_max_width(self, max_width: Option<f32>) -> Self
pub fn with_max_width(self, max_width: Option<f32>) -> Self
The style wrapping lines at max_width pixels (None: no wrapping).
Trait Implementations§
Source§impl Clone for ParagraphStyle
impl Clone for ParagraphStyle
Source§impl Debug for ParagraphStyle
impl Debug for ParagraphStyle
Source§impl PartialEq for ParagraphStyle
impl PartialEq for ParagraphStyle
impl StructuralPartialEq for ParagraphStyle
Auto Trait Implementations§
impl Freeze for ParagraphStyle
impl RefUnwindSafe for ParagraphStyle
impl Send for ParagraphStyle
impl Sync for ParagraphStyle
impl Unpin for ParagraphStyle
impl UnsafeUnpin for ParagraphStyle
impl UnwindSafe for ParagraphStyle
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