pub struct GlyphCache { /* private fields */ }Expand description
Cache of rasterized glyphs, keyed by font, glyph and size.
§Examples
use ferrochart_text::{GlyphCache, TextEngine};
let engine = TextEngine::new();
let mut cache = GlyphCache::default();
let w = cache.get(&engine, 0, 'A', 12.0).map(|g| g.width);
assert!(w.is_some_and(|w| w > 0));
assert!(cache.get(&engine, 0, ' ', 12.0).is_none());
assert_eq!(cache.len(), 2);Implementations§
Source§impl GlyphCache
impl GlyphCache
Sourcepub fn get(
&mut self,
engine: &TextEngine,
id: u16,
c: char,
size: f32,
) -> Option<&GlyphBitmap>
pub fn get( &mut self, engine: &TextEngine, id: u16, c: char, size: f32, ) -> Option<&GlyphBitmap>
The bitmap of c, rasterizing it on first use.
Trait Implementations§
Source§impl Debug for GlyphCache
impl Debug for GlyphCache
Auto Trait Implementations§
impl Forget for GlyphCache
impl Freeze for GlyphCache
impl Move for GlyphCache
impl RefUnwindSafe for GlyphCache
impl Send for GlyphCache
impl Sync for GlyphCache
impl Unpin for GlyphCache
impl UnsafeUnpin for GlyphCache
impl UnwindSafe for GlyphCache
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