pub struct GlyphAtlas { /* private fields */ }Expand description
Dynamic glyph coverage atlas for one face at one pixel size.
Implementations§
Source§impl GlyphAtlas
impl GlyphAtlas
pub fn new(font_bytes: &[u8], size: f32) -> Result<Self>
Sourcepub fn set_monospace(&mut self, enabled: bool)
pub fn set_monospace(&mut self, enabled: bool)
Treats every advance as the space advance, which is what a terminal grid wants and what the bundled DejaVu Sans Mono faces already are.
pub fn size(&self) -> f32
pub fn line_height(&self) -> f32
pub fn ascent(&self) -> f32
pub fn descent(&self) -> f32
Sourcepub fn cell_advance(&self) -> Option<f32>
pub fn cell_advance(&self) -> Option<f32>
Cell width for a monospace face, or None when proportional.
pub fn take_dirty(&mut self) -> bool
pub fn coverage(&self) -> &[u8] ⓘ
pub fn atlas_size(&self) -> u32
Sourcepub fn measure(&mut self, text: &str) -> f32
pub fn measure(&mut self, text: &str) -> f32
Width of text in pixels, used for hit testing and truncation.
Sourcepub fn ellipsize(&mut self, text: &str, max_width: f32) -> String
pub fn ellipsize(&mut self, text: &str, max_width: f32) -> String
Truncates to max_width, appending an ellipsis when it does not fit.
pub fn advance(&mut self, ch: char) -> f32
Auto Trait Implementations§
impl Freeze for GlyphAtlas
impl RefUnwindSafe for GlyphAtlas
impl Send for GlyphAtlas
impl Sync for GlyphAtlas
impl Unpin for GlyphAtlas
impl UnsafeUnpin for GlyphAtlas
impl UnwindSafe for GlyphAtlas
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