From f2882bf85476cd55eaad0594d983fbcf8a1ef778 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 25 Aug 2021 13:24:30 +0200 Subject: Support decoding of mac roman names This allows discovery of Apple fonts without unicode name entries. --- src/export/pdf.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/export') diff --git a/src/export/pdf.rs b/src/export/pdf.rs index 9b9d0e8e..65c922ab 100644 --- a/src/export/pdf.rs +++ b/src/export/pdf.rs @@ -15,7 +15,7 @@ use ttf_parser::{name_id, GlyphId, Tag}; use super::subset; use crate::color::Color; -use crate::font::{FaceId, FontStore}; +use crate::font::{find_name, FaceId, FontStore}; use crate::geom::{self, Em, Length, Size}; use crate::image::{Image, ImageId, ImageStore}; use crate::layout::{Element, Frame, Geometry, Paint}; @@ -289,12 +289,7 @@ impl<'a> PdfExporter<'a> { let face = self.fonts.get(face_id); let ttf = face.ttf(); - let name = ttf - .names() - .find(|entry| { - entry.name_id() == name_id::POST_SCRIPT_NAME && entry.is_unicode() - }) - .and_then(|entry| entry.to_string()) + let name = find_name(ttf.names(), name_id::POST_SCRIPT_NAME) .unwrap_or_else(|| "unknown".to_string()); let base_font = format!("ABCDEF+{}", name); -- cgit v1.2.3