diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-02-27 20:26:38 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-02-27 20:26:38 +0100 |
| commit | 4d4824aa083589871f7453651269df613b18180f (patch) | |
| tree | 6b0233258d37fd22eb339e7f579459d8aa0ec13a /src | |
| parent | da602613769cc73aad3fbaf8aa3c83d5d0fb85dc (diff) | |
Improve name table capabilities ♻
Diffstat (limited to 'src')
| -rw-r--r-- | src/pdf.rs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -10,7 +10,7 @@ use pdf::font::{ Type0Font, CMapEncoding, CIDFont, CIDFontType, CIDSystemInfo, WidthRecord, FontDescriptor, FontFlags, EmbeddedFont, GlyphUnit }; -use opentype::{OpenTypeReader, tables}; +use opentype::{OpenTypeReader, tables::{self, NameEntry}}; /// A type that is a sink for documents that can be written in the _PDF_ format. @@ -190,8 +190,8 @@ impl<'a, W: Write> PdfCreator<'a, W> { let ratio = 1000.0 / (font_data.head.units_per_em as f32); let convert = |x| (ratio * x as f32).round() as GlyphUnit; - let base_font = font_data.name.post_script_name.as_ref() - .unwrap_or(&self.doc.font); + let font_name = font_data.name.get_decoded(NameEntry::PostScriptName); + let base_font = font_name.as_ref().unwrap_or(&self.doc.font); self.writer.write_obj(id, &Type0Font::new( base_font.clone(), |
