pub struct GlyphAtlas { /* private fields */ }Expand description
Memoized glyph rasterization cache shared across frames with O(1) slot indexing, ASCII direct tables, bounded LRU budget, and hit/miss telemetry.
Implementations§
Source§impl GlyphAtlas
Caching lookup, bounded LRU eviction, and telemetry operations for GlyphAtlas.
impl GlyphAtlas
Caching lookup, bounded LRU eviction, and telemetry operations for GlyphAtlas.
Sourcepub fn effective_budget_bytes(&self) -> usize
pub fn effective_budget_bytes(&self) -> usize
Sourcepub fn set_memory_budget(&mut self, max_bytes: usize)
pub fn set_memory_budget(&mut self, max_bytes: usize)
Configures a bounded resident memory budget in bytes and immediately evicts cold glyphs if currently over budget.
§Arguments
&Self- Mutable glyph atlas reference.usize- Maximum resident byte budget (clamped to>= 1024).
Sourcepub fn evict_if_over_budget(&mut self)
pub fn evict_if_over_budget(&mut self)
Evicts least-recently-used glyphs when resident_bytes exceeds the active budget and slots are unpinned.
§Arguments
&Self- Mutable glyph atlas reference.
Sourcepub fn get_or_rasterize(&mut self, key: GlyphKey) -> &RasterizedGlyph
pub fn get_or_rasterize(&mut self, key: GlyphKey) -> &RasterizedGlyph
Sourcepub fn get_or_rasterize_with(
&mut self,
key: GlyphKey,
provider: &dyn SystemFontProvider,
) -> &RasterizedGlyph
pub fn get_or_rasterize_with( &mut self, key: GlyphKey, provider: &dyn SystemFontProvider, ) -> &RasterizedGlyph
Returns the cached RasterizedGlyph for key, rasterizing through provider on a miss.
§Arguments
&Self- Mutable reference to the glyph atlas.GlyphKey- Quantized glyph lookup key.&dyn SystemFontProvider- Native or deterministic font rasterization provider.
§Returns
&RasterizedGlyph- Cached coverage bitmap and pixel metrics.
Sourcepub fn pack_rgba_atlas(&self) -> PackedGlyphAtlas
pub fn pack_rgba_atlas(&self) -> PackedGlyphAtlas
Source§impl GlyphAtlas
impl GlyphAtlas
pub fn get_revision(&self) -> u64
pub fn get_budget_bytes(&self) -> usize
pub fn get_resident_bytes(&self) -> usize
pub fn get_cache_hits(&self) -> u64
pub fn get_cache_misses(&self) -> u64
pub fn get_evictions(&self) -> u64
Trait Implementations§
Source§impl Clone for GlyphAtlas
impl Clone for GlyphAtlas
Source§impl Debug for GlyphAtlas
impl Debug for GlyphAtlas
Auto Trait Implementations§
impl Forget for GlyphAtlas
impl Freeze for GlyphAtlaswhere
*const u8 is !null: Freeze,
PhantomData<u64>: Freeze,
PhantomData<(GlyphKey, RasterizedGlyph)>: Freeze,
PhantomData<AsciiGlyphStyleTable>: Freeze,
impl Move for GlyphAtlas
impl RefUnwindSafe for GlyphAtlas
impl Send for GlyphAtlaswhere
RawVecInner: Send,
impl Sync for GlyphAtlaswhere
RawVecInner: Sync,
impl Unpin for GlyphAtlas
impl UnsafeUnpin for GlyphAtlaswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u64>: UnsafeUnpin,
PhantomData<(GlyphKey, RasterizedGlyph)>: UnsafeUnpin,
PhantomData<AsciiGlyphStyleTable>: UnsafeUnpin,
impl UnwindSafe for GlyphAtlaswhere
RawVecInner: UnwindSafe,
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