pub struct GlyphAtlas { /* private fields */ }Implementations§
Source§impl GlyphAtlas
impl GlyphAtlas
pub fn new(width: u32, height: u32) -> Self
Sourcepub fn id(&self) -> u64
pub fn id(&self) -> u64
Unique identity for this atlas instance.
Glyph UVs are only meaningful for the atlas that produced them; caches must compare this id before reusing shaped output across text systems.
pub fn size(&self) -> (u32, u32)
pub fn version(&self) -> u64
pub fn epoch(&self) -> u64
pub fn pixels(&self) -> &[u8] ⓘ
Sourcepub fn compact(&mut self)
pub fn compact(&mut self)
Drops the least recently used half of the atlas and repacks it.
Entries that were not looked up recently are evicted, the survivors are moved to the top of the bitmap, and the whole texture is marked dirty. Glyph UVs emitted before this call become stale, so callers that keep a render list across the call must repaint it (the renderer leaves this until after the frame has been uploaded).
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Compacts the atlas and shrinks the bitmap to fit the survivors.
The texture never grows here; dimensions are rounded up to the next power of two and clamped to the current size, with a small floor so a single eviction does not immediately trigger another resize.