pub struct Type3GlyphCache { /* private fields */ }Expand description
Thread-safe cache for Type 3 glyph outlines with a size limit.
Caches the parsed path operations for each (stream ObjectId, character code,
font matrix) triple so that repeated rendering of the same glyph avoids
re-parsing. When the cache reaches max_capacity, approximately 20% of
entries are evicted to make room for new ones.
Implementations§
Source§impl Type3GlyphCache
impl Type3GlyphCache
Sourcepub fn with_capacity(max_capacity: usize) -> Self
pub fn with_capacity(max_capacity: usize) -> Self
Create a new cache with the specified maximum capacity.
Sourcepub fn max_capacity(&self) -> usize
pub fn max_capacity(&self) -> usize
Returns the maximum capacity.
Sourcepub fn get_or_insert(
&self,
stream_id: ObjectId,
code: u8,
font_matrix: &[f32; 6],
compute: impl FnOnce() -> Type3GlyphEntry,
) -> Type3GlyphEntry
pub fn get_or_insert( &self, stream_id: ObjectId, code: u8, font_matrix: &[f32; 6], compute: impl FnOnce() -> Type3GlyphEntry, ) -> Type3GlyphEntry
Get a cached entry or compute and insert it.
If the (stream_id, code, font_matrix) triple is already cached, returns
the cached entry. Otherwise, calls compute to produce a new entry,
inserts it, and returns it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Type3GlyphCache
impl !RefUnwindSafe for Type3GlyphCache
impl Send for Type3GlyphCache
impl Sync for Type3GlyphCache
impl Unpin for Type3GlyphCache
impl UnsafeUnpin for Type3GlyphCache
impl UnwindSafe for Type3GlyphCache
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