Embed a single monospace face to shrink PDFs
This commit is contained in:
1 parent
2076da8f21
commit
ea14b3edbf
5 files changed
+41
-5
No files matched your search
Vendored
+10
@@ -115,6 +115,16 @@ impl FontCache {
|
||||
}
|
||||
|
||||
/// Adds the given font family to the cache and returns a reference to it.
|
||||
pub fn add_font_family_single(&mut self, family: FontFamily<FontData>) -> FontFamily<Font> {
|
||||
let font = self.add_font(family.regular);
|
||||
FontFamily {
|
||||
regular: font,
|
||||
bold: font,
|
||||
italic: font,
|
||||
bold_italic: font,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_font_family(&mut self, family: FontFamily<FontData>) -> FontFamily<Font> {
|
||||
FontFamily {
|
||||
regular: self.add_font(family.regular),
|
||||
|
||||
Vendored
+7
@@ -608,6 +608,13 @@ impl Document {
|
||||
self.context.font_cache.add_font_family(font_family)
|
||||
}
|
||||
|
||||
pub fn add_font_family_single(
|
||||
&mut self,
|
||||
font_family: fonts::FontFamily<fonts::FontData>,
|
||||
) -> fonts::FontFamily<fonts::Font> {
|
||||
self.context.font_cache.add_font_family_single(font_family)
|
||||
}
|
||||
|
||||
/// Returns the font cache used by this document.
|
||||
///
|
||||
/// You can use the font cache to get the default font and to query glyph metrics for a font.
|
||||
|
||||
Reference in new issue
Block a user