1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Fallback to using the name table to infer the encoding for TrueType fonts missing such data (issue 15910)

The relevant TrueType font is missing both /ToUnicode *and* /Encoding entires, either of which would have prevented the (current) broken textLayer rendering.
My first idea was that we could use the `post` table in the TrueType font, see https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6post.html, to get the actual glyphNames and amend the fallback ToUnicode-map that way. Unfortunately that didn't work, since the `post` table only contained ".notdef" and "" (i.e. empty string) entries.

Instead we try to use the `name` table in the TrueType font, see https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html, to determine if the platform is Windows and thus fallback to generate a ToUnicode-map from the `WinAnsiEncoding`.
This commit is contained in:
Jonas Jenwald 2023-01-17 15:26:58 +01:00
parent d8d5545e03
commit d6be5141e9
4 changed files with 87 additions and 13 deletions

View file

@ -242,6 +242,7 @@
!bug1108301.pdf
!issue10301.pdf
!bug1157493.pdf
!issue15910.pdf
!issue4260_reduced.pdf
!bug1250079.pdf
!bug1473809.pdf

BIN
test/pdfs/issue15910.pdf Normal file

Binary file not shown.

View file

@ -3056,6 +3056,12 @@
"link": true,
"type": "eq"
},
{ "id": "issue15910",
"file": "pdfs/issue15910.pdf",
"md5": "6429d8490e11e226b1cbdf2033c04237",
"rounds": 1,
"type": "text"
},
{ "id": "issue7872",
"file": "pdfs/issue7872.pdf",
"md5": "81781dfecfcb7e9cd9cc7e60f8b747b7",