mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #18390 from alexcat3/fix-issue-18099
Handle toUnicode cMaps that omit leading zeros in hex encoded UTF-16 (issue 18099)
This commit is contained in:
commit
5ee61690f3
4 changed files with 21 additions and 0 deletions
|
@ -3852,6 +3852,11 @@ class PartialEvaluator {
|
|||
map[charCode] = String.fromCodePoint(token);
|
||||
return;
|
||||
}
|
||||
// Add back omitted leading zeros on odd length tokens
|
||||
// (fixes issue #18099)
|
||||
if (token.length % 2 !== 0) {
|
||||
token = "\u0000" + token;
|
||||
}
|
||||
const str = [];
|
||||
for (let k = 0; k < token.length; k += 2) {
|
||||
const w1 = (token.charCodeAt(k) << 8) | token.charCodeAt(k + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue