diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-01-04 22:43:26 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-01-04 22:43:26 +0100 |
| commit | 7b84f3b553de672e5374e142467f63b10009aeca (patch) | |
| tree | fd8265abc8c62213520628babc0cfc3a6f8e98aa /src/export/pdf.rs | |
| parent | 5dfaffc5bdfa811c135f0140c0a0ba917eb8c70f (diff) | |
Adopt new font loading engine ⚙
Diffstat (limited to 'src/export/pdf.rs')
| -rw-r--r-- | src/export/pdf.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/export/pdf.rs b/src/export/pdf.rs index 0d097a33..c5bc6ee8 100644 --- a/src/export/pdf.rs +++ b/src/export/pdf.rs @@ -13,7 +13,7 @@ use tide::font::{ use toddle::Error as FontError; use toddle::font::OwnedFont; -use toddle::query::SharedFontLoader; +use toddle::query::{SharedFontLoader, FontIndex}; use toddle::tables::{ CharMap, Header, HorizontalMetrics, MacStyleFlags, Name, NameEntry, Post, OS2 @@ -59,7 +59,7 @@ struct ExportProcess<'d, W: Write> { /// go through all font usages and assign a new index for each used font. /// This remapping is stored here because we need it when converting the /// layout actions in `ExportProcess::write_page`. - font_remap: HashMap<usize, usize>, + font_remap: HashMap<FontIndex, usize>, /// These are the fonts sorted by their *new* ids, that is, the values of `font_remap`. fonts: Vec<OwnedFont>, @@ -99,13 +99,13 @@ impl<'d, W: Write> ExportProcess<'d, W> { fn subset_fonts( layouts: &'d MultiLayout, font_loader: &SharedFontLoader - ) -> PdfResult<(Vec<OwnedFont>, HashMap<usize, usize>)> + ) -> PdfResult<(Vec<OwnedFont>, HashMap<FontIndex, usize>)> { let mut fonts = Vec::new(); - let mut font_chars: HashMap<usize, HashSet<char>> = HashMap::new(); - let mut old_to_new: HashMap<usize, usize> = HashMap::new(); - let mut new_to_old: HashMap<usize, usize> = HashMap::new(); - let mut active_font = 0; + let mut font_chars: HashMap<FontIndex, HashSet<char>> = HashMap::new(); + let mut old_to_new: HashMap<FontIndex, usize> = HashMap::new(); + let mut new_to_old: HashMap<usize, FontIndex> = HashMap::new(); + let mut active_font = FontIndex::MAX; // We want to find out which fonts are used at all and which are chars // are used for these. We use this information to create subsetted fonts. |
