mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Fix encoding issues when printing/saving a form with non-ascii characters
This commit is contained in:
parent
187542da8d
commit
56424967f2
6 changed files with 508 additions and 57 deletions
|
@ -338,6 +338,22 @@ class CMap {
|
|||
out.length = 1;
|
||||
}
|
||||
|
||||
getCharCodeLength(charCode) {
|
||||
const codespaceRanges = this.codespaceRanges;
|
||||
for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
|
||||
// Check each codespace range to see if it falls within.
|
||||
const codespaceRange = codespaceRanges[n];
|
||||
for (let k = 0, kk = codespaceRange.length; k < kk; ) {
|
||||
const low = codespaceRange[k++];
|
||||
const high = codespaceRange[k++];
|
||||
if (charCode >= low && charCode <= high) {
|
||||
return n + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
get length() {
|
||||
return this._map.length;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue