From 6dd31183be43aae0009271d28f18075a31affff9 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 19 Aug 2024 19:10:35 +0200 Subject: [PATCH] Use standard glyph mapping for non-embedded and non-composite Calibri fonts (issue 18208) Given that we handle non-embedded Calibri fonts as "mapped to standard font", we really ought to be able to use the same glyph mapping as for an actual standard font. Note that this actually improves consistency in the code, given how we already handle such fonts if they happen to be of the `CIDFontType2` type; see https://github.com/mozilla/pdf.js/blob/b47c7eca83c35b8f9ea170aa3742fc70359726c2/src/core/fonts.js#L1186-L1190 --- src/core/fonts.js | 2 +- test/pdfs/issue18208.pdf.link | 1 + test/test_manifest.json | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/pdfs/issue18208.pdf.link diff --git a/src/core/fonts.js b/src/core/fonts.js index 29f186fa3..6b0eb40c6 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -1244,7 +1244,7 @@ class Font { getDingbatsGlyphsUnicode(), this.differences ); - } else if (isStandardFont) { + } else if (isStandardFont || isMappedToStandardFont) { const map = buildToFontChar( this.defaultEncoding, getGlyphsUnicode(), diff --git a/test/pdfs/issue18208.pdf.link b/test/pdfs/issue18208.pdf.link new file mode 100644 index 000000000..e5d008fae --- /dev/null +++ b/test/pdfs/issue18208.pdf.link @@ -0,0 +1 @@ +https://github.com/user-attachments/files/15587595/d403d5d5-f3e1-411d-b289-9b497069b80e.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 8845acb99..82e0024cb 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -3012,6 +3012,15 @@ "rounds": 1, "type": "text" }, + { + "id": "issue18208", + "file": "pdfs/issue18208.pdf", + "md5": "d07311117b5cc970159b09977898996b", + "link": true, + "rounds": 1, + "lastPage": 1, + "type": "eq" + }, { "id": "issue11139", "file": "pdfs/issue11139.pdf",