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

Merge pull request #6476 from Snuffleupagus/PartialEvaluator_readToUnicode-cmap-length

Right-size the `map` array in PartialEvaluator_readToUnicode
This commit is contained in:
Brendan Dahl 2015-10-09 10:31:28 -07:00
commit 3eaeacfe19
3 changed files with 12 additions and 1 deletions

View file

@ -306,6 +306,10 @@ var CMap = (function CMapClosure() {
out.length = 1;
},
get length() {
return this._map.length;
},
get isIdentityCMap() {
if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
return false;
@ -382,6 +386,10 @@ var IdentityCMap = (function IdentityCMapClosure() {
readCharCode: CMap.prototype.readCharCode,
get length() {
return 0x10000;
},
get isIdentityCMap() {
error('should not access .isIdentityCMap');
}

View file

@ -1380,7 +1380,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
if (cmap instanceof IdentityCMap) {
return new IdentityToUnicodeMap(0, 0xFFFF);
}
var map = [];
var map = new Array(cmap.length);
// Convert UTF-16BE
// NOTE: cmap can be a sparse array, so use forEach instead of for(;;)
// to iterate over all keys.