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

Tweak adjustType1ToUnicode for fonts with a predefined *named* encoding (bug 1811668, PR 14050 follow-up)

*Please note:* I cannot reproduce the problem reported in bug 1811668, regarding the context menu, and in any case it's not clear that that part is even a PDF Viewer bug.

Looking at bug 1811668 I couldn't help but noticing that the textLayer isn't correct, and it's unfortunately once again a problem with the `adjustType1ToUnicode` function. That's intended to help improve text-selection for fonts without a /ToUnicode-entry, and in many cases it does help (the original PR fixed lots of issues) however it's also caused some problems.

In order to improve text-selection in bug 1811668, we'll now properly ignore fonts that have a predefined *named* encoding specified since that's really the intention with PR 14050.
This commit is contained in:
Jonas Jenwald 2023-01-21 12:00:17 +01:00
parent 7b95788248
commit 40a46e4397
4 changed files with 8 additions and 1 deletions

View file

@ -201,7 +201,7 @@ function adjustType1ToUnicode(properties, builtInEncoding) {
for (const charCode in builtInEncoding) {
if (properties.hasEncoding) {
if (
properties.differences.length === 0 ||
properties.baseEncodingName ||
properties.differences[charCode] !== undefined
) {
continue; // The font dictionary has an `Encoding`/`Differences` entry.