Merge pull request #14050 from Snuffleupagus/issue-14048

Tweak how fonts with an /Encoding are handled in `adjustToUnicode` (issue 14048, PR 13277 follow-up)
This commit is contained in:
Tim van der Meij 2021-09-19 12:42:43 +02:00 committed by GitHub
commit c7dd99da76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 2 deletions

View File

@ -148,9 +148,9 @@ function adjustToUnicode(properties, builtInEncoding) {
if (properties.toUnicode.has(charCode)) {
continue; // The font dictionary has a `ToUnicode` entry.
}
} else {
} else if (properties.hasEncoding) {
if (
properties.hasEncoding &&
properties.differences.length === 0 ||
properties.differences[charCode] !== undefined
) {
continue; // The font dictionary has an `Encoding`/`Differences` entry.

View File

@ -431,6 +431,7 @@
!annotation-square-circle.pdf
!annotation-square-circle-without-appearance.pdf
!annotation-stamp.pdf
!issue14048.pdf
!annotation-fileattachment.pdf
!annotation-text-widget.pdf
!annotation-choice-widget.pdf

BIN
test/pdfs/issue14048.pdf Normal file

Binary file not shown.

View File

@ -4301,6 +4301,12 @@
"rounds": 1,
"type": "eq"
},
{ "id": "issue14048",
"file": "pdfs/issue14048.pdf",
"md5": "770026875a93dc44a187905f4dcd3de2",
"rounds": 1,
"type": "text"
},
{ "id": "blendmode",
"file": "pdfs/blendmode.pdf",
"md5": "5a86e7e9333e93c58abc3f382e1e6ea2",