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

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:
Jonas Jenwald 2021-09-18 22:28:23 +02:00
parent 83d3bb43f4
commit 8ea27ce157
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.