diff options
author | Khaled Hosny <khaled@aliftype.com> | 2023-05-08 18:35:10 +0300 |
---|---|---|
committer | Albert Astals Cid <tsdgeos@yahoo.es> | 2023-05-27 09:48:58 +0000 |
commit | 333b04802a3a9dbdb0d0e0caec553fd1037c4c92 (patch) | |
tree | b80bdfe3fc568d0e2ce1c4cc3adea209d3e7b42b | |
parent | 82fc01784dcfc3e22ee0053e4ecfa9b500119b19 (diff) |
Try harder to get Type 3 font name
There is no BaseFont in Type 3 fonts, so we first try fontDescriptor’s
FontName, but fontDescriptor is optional so we then try the Name key.
Fixes #1396
-rw-r--r-- | poppler/GfxFont.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index 954fb8b3..20e02bb0 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc @@ -209,6 +209,25 @@ std::unique_ptr<GfxFont> GfxFont::makeFont(XRef *xref, const char *tagA, Ref idA name = obj1.getName(); } + // There is no BaseFont in Type 3 fonts, try fontDescriptor.FontName + if (!name) { + Object fontDesc = fontDict->lookup("FontDescriptor"); + if (fontDesc.isDict()) { + Object obj2 = fontDesc.dictLookup("FontName"); + if (obj2.isName()) { + name = obj2.getName(); + } + } + } + + // As a last resort try the Name key + if (!name) { + Object obj2 = fontDict->lookup("Name"); + if (obj2.isName()) { + name = obj2.getName(); + } + } + // get embedded font ID and font type typeA = getFontType(xref, fontDict, &embFontIDA); |