pub struct FontCache { /* private fields */ }Expand description
Thread-safe font cache
Implementations§
Source§impl FontCache
impl FontCache
Sourcepub fn add_font(&self, name: impl Into<String>, font: Font) -> Result<()>
pub fn add_font(&self, name: impl Into<String>, font: Font) -> Result<()>
Add a font to the cache
Sourcepub fn font_names(&self) -> Vec<String>
pub fn font_names(&self) -> Vec<String>
Get all font names in the cache, sorted lexicographically.
Sorting is intentional: the writer (PdfWriter::write_fonts) iterates
this list to allocate ObjectIds for each font. Returning HashMap
iteration order (randomized per instance) caused two builds of the
same document to allocate different ObjectIds, cascading into
divergent xref tables and resource references — see #334 item #5.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FontCache
impl RefUnwindSafe for FontCache
impl Send for FontCache
impl Sync for FontCache
impl Unpin for FontCache
impl UnsafeUnpin for FontCache
impl UnwindSafe for FontCache
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