mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 01:28:06 +02:00
Don't allow adjustToUnicode
to extend a built-in /ToUnicode map (issue 15352)
Given that the change in PR 13393 was slightly speculative, given the lack of test-cases, let's just revert part of that to fix the referenced issue. Based on a quick look at old issues and existing test-cases, it seems that most (if not all) PDF documents that benefit from using the font-data in this way lack any /ToUnicode maps which should mean that they're unaffected by these changes.
This commit is contained in:
parent
50d72fc111
commit
12d60e0acf
3 changed files with 13 additions and 5 deletions
|
@ -137,6 +137,9 @@ function adjustToUnicode(properties, builtInEncoding) {
|
|||
if (properties.isInternalFont) {
|
||||
return;
|
||||
}
|
||||
if (properties.hasIncludedToUnicodeMap) {
|
||||
return; // The font dictionary has a `ToUnicode` entry.
|
||||
}
|
||||
if (builtInEncoding === properties.defaultEncoding) {
|
||||
return; // No point in trying to adjust `toUnicode` if the encodings match.
|
||||
}
|
||||
|
@ -146,11 +149,7 @@ function adjustToUnicode(properties, builtInEncoding) {
|
|||
const toUnicode = [],
|
||||
glyphsUnicodeMap = getGlyphsUnicode();
|
||||
for (const charCode in builtInEncoding) {
|
||||
if (properties.hasIncludedToUnicodeMap) {
|
||||
if (properties.toUnicode.has(charCode)) {
|
||||
continue; // The font dictionary has a `ToUnicode` entry.
|
||||
}
|
||||
} else if (properties.hasEncoding) {
|
||||
if (properties.hasEncoding) {
|
||||
if (
|
||||
properties.differences.length === 0 ||
|
||||
properties.differences[charCode] !== undefined
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue