Handle the Encoding being a dictionary in PartialEvaluator_preEvaluateFont (bug 1157493)
*This is a regression from PR 4423.* Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1157493.
This commit is contained in:
parent
48b2f6d023
commit
760222cf0b
@ -1567,6 +1567,21 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
hash.update(encoding.name);
|
||||
} else if (isRef(encoding)) {
|
||||
hash.update(encoding.num + '_' + encoding.gen);
|
||||
} else if (isDict(encoding)) {
|
||||
var keys = encoding.getKeys();
|
||||
for (var i = 0, ii = keys.length; i < ii; i++) {
|
||||
var entry = encoding.getRaw(keys[i]);
|
||||
if (isName(entry)) {
|
||||
hash.update(entry.name);
|
||||
} else if (isRef(entry)) {
|
||||
hash.update(entry.num + '_' + entry.gen);
|
||||
} else if (isArray(entry)) { // 'Differences' entry.
|
||||
// Ideally we should check the contents of the array, but to avoid
|
||||
// parsing it here and then again in |extractDataStructures|,
|
||||
// we only use the array length for now (fixes bug1157493.pdf).
|
||||
hash.update(entry.length.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
|
||||
|
@ -192,6 +192,10 @@ var Dict = (function DictClosure() {
|
||||
return all;
|
||||
},
|
||||
|
||||
getKeys: function Dict_getKeys() {
|
||||
return Object.keys(this.map);
|
||||
},
|
||||
|
||||
set: function Dict_set(key, value) {
|
||||
this.map[key] = value;
|
||||
},
|
||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -32,6 +32,7 @@
|
||||
!bug894572.pdf
|
||||
!bug911034.pdf
|
||||
!bug1108301.pdf
|
||||
!bug1157493.pdf
|
||||
!pdfjsbad1586.pdf
|
||||
!freeculture.pdf
|
||||
!pdfkit_compressed.pdf
|
||||
|
BIN
test/pdfs/bug1157493.pdf
Normal file
BIN
test/pdfs/bug1157493.pdf
Normal file
Binary file not shown.
@ -1164,6 +1164,13 @@
|
||||
"link": false,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "bug1157493",
|
||||
"file": "pdfs/bug1157493.pdf",
|
||||
"md5": "df96eddacf186c28a91e699800180c4f",
|
||||
"rounds": 1,
|
||||
"link": false,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue1466",
|
||||
"file": "pdfs/issue1466.pdf",
|
||||
"md5": "8a8877432e5bb10cfd50d60488d947bb",
|
||||
|
Loading…
Reference in New Issue
Block a user