pub struct ParagraphBuilder<'a> { /* private fields */ }Expand description
ParagraphBuilder assembles styled text into a Paragraph for layout and drawing.
Each added span can use a different TextStyle. Building selects fonts
from the borrowed FontCollection and shapes the text into glyphs.
Implementations§
Source§impl<'a> ParagraphBuilder<'a>
impl<'a> ParagraphBuilder<'a>
Sourcepub fn new(fonts: &'a mut FontCollection) -> Self
pub fn new(fonts: &'a mut FontCollection) -> Self
new creates an empty builder with the default ParagraphStyle.
Sourcepub fn style(&mut self, style: ParagraphStyle) -> &mut Self
pub fn style(&mut self, style: ParagraphStyle) -> &mut Self
style replaces the paragraph-level layout style.
Sourcepub fn add_text(&mut self, text: &str, style: &TextStyle) -> &mut Self
pub fn add_text(&mut self, text: &str, style: &TextStyle) -> &mut Self
add_text appends a UTF-8 text span with its own style.
The zero-based call order defines indices accepted by
Paragraph::update_color.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ParagraphBuilder<'a>
impl<'a> !Send for ParagraphBuilder<'a>
impl<'a> !Sync for ParagraphBuilder<'a>
impl<'a> !UnwindSafe for ParagraphBuilder<'a>
impl<'a> Freeze for ParagraphBuilder<'a>
impl<'a> Unpin for ParagraphBuilder<'a>
impl<'a> UnsafeUnpin for ParagraphBuilder<'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