pub struct TextLayoutParams<'a> {
pub text: &'a str,
pub style: TextStyle,
pub max_width: Option<f32>,
pub wrap_mode: WrapMode,
}Expand description
Inputs for text layout (content, style, width, wrap).
§Examples
use ailloli_ui_core::{Color, FontId, TextStyle};
use ailloli_ui_text::{TextLayoutParams, WrapMode};
let params = TextLayoutParams::new("hello", TextStyle::new(FontId::Ui, 16, Color::WHITE));
assert_eq!(params.max_width, None);
assert_eq!(params.wrap_mode, WrapMode::Word);Fields§
§text: &'a strUTF-8 text to shape; an empty string is valid.
style: TextStyleBase font, logical-pixel size, color, and paint decoration.
max_width: Option<f32>Optional wrap width in logical pixels; None means unconstrained.
This value is ignored when Self::wrap_mode is WrapMode::NoWrap.
wrap_mode: WrapModeLine-breaking policy.
Implementations§
Source§impl<'a> TextLayoutParams<'a>
impl<'a> TextLayoutParams<'a>
Sourcepub fn new(text: &'a str, style: TextStyle) -> Self
pub fn new(text: &'a str, style: TextStyle) -> Self
Creates an unconstrained request using WrapMode::Word.
§Examples
use ailloli_ui_core::{Color, FontId, TextStyle};
use ailloli_ui_text::{TextLayoutParams, WrapMode};
let params = TextLayoutParams::new("Ailloli", TextStyle::new(FontId::Mono, 13, Color::BLACK));
assert_eq!(params.text, "Ailloli");
assert_eq!(params.wrap_mode, WrapMode::Word);Trait Implementations§
Source§impl<'a> Clone for TextLayoutParams<'a>
impl<'a> Clone for TextLayoutParams<'a>
Source§fn clone(&self) -> TextLayoutParams<'a>
fn clone(&self) -> TextLayoutParams<'a>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for TextLayoutParams<'a>
impl<'a> Debug for TextLayoutParams<'a>
impl<'a> Copy for TextLayoutParams<'a>
Auto Trait Implementations§
impl<'a> Freeze for TextLayoutParams<'a>
impl<'a> RefUnwindSafe for TextLayoutParams<'a>
impl<'a> Send for TextLayoutParams<'a>
impl<'a> Sync for TextLayoutParams<'a>
impl<'a> Unpin for TextLayoutParams<'a>
impl<'a> UnwindSafe for TextLayoutParams<'a>
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