pub struct TextSystem { /* private fields */ }Expand description
Font database plus reusable layout scratch space. Create one per app.
Implementations§
Source§impl TextSystem
impl TextSystem
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a text system with Inter registered and used for every generic family.
Sourcepub fn register_font(&mut self, bytes: Vec<u8>) -> Vec<String>
pub fn register_font(&mut self, bytes: Vec<u8>) -> Vec<String>
Registers a font file (TTF/OTF/TTC) and returns the family names it provides.
Sourcepub fn layout(&mut self, text: &str, attrs: &TextAttrs) -> TextLayout
pub fn layout(&mut self, text: &str, attrs: &TextAttrs) -> TextLayout
Shapes text. Line breaking happens later in TextLayout::measure.
Sourcepub fn layout_ellipsized(
&mut self,
text: &str,
attrs: &TextAttrs,
max_width: f32,
) -> TextLayout
pub fn layout_ellipsized( &mut self, text: &str, attrs: &TextAttrs, max_width: f32, ) -> TextLayout
Shapes text on one line, cut at a character boundary and ended with
… so it fits max_width. Text that already fits comes back whole.
Trait Implementations§
Source§impl Debug for TextSystem
impl Debug for TextSystem
Auto Trait Implementations§
impl !Freeze for TextSystem
impl !RefUnwindSafe for TextSystem
impl !UnwindSafe for TextSystem
impl Send for TextSystem
impl Sync for TextSystem
impl Unpin for TextSystem
impl UnsafeUnpin for TextSystem
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