Tweak how fonts with an /Encoding are handled in adjustToUnicode
(issue 14048, PR 13277 follow-up)
Currently we only exclude /Encoding entries that also contains a /Differences array, which is the cause of the text-selection problem in the referenced issue. In order to address this we'll now also exclude /Encoding entries that contain one of the predefined *named* encodings, and no longer require that it also contains a /Differences array. *Please note:* This patch cases a small "regression" in the `bug1130815-text` test-case, however this is actually an improvement when compared with Adobe Reader and PDFium (in Google Chrome).
This commit is contained in:
parent
83d3bb43f4
commit
8ea27ce157
@ -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.
|
||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -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
BIN
test/pdfs/issue14048.pdf
Normal file
Binary file not shown.
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user