Merge pull request #7920 from Snuffleupagus/bug-1157493-followup

Improve the handling of `Encoding` dictionary, with `Differences` array, in `PartialEvaluator_preEvaluateFont`
This commit is contained in:
Jonas Jenwald 2016-12-29 10:52:31 +01:00 committed by GitHub
commit 59afb4b9f0

View File

@ -2189,11 +2189,19 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
hash.update(entry.name);
} else if (isRef(entry)) {
hash.update(entry.toString());
} 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());
} else if (isArray(entry)) {
// 'Differences' array (fixes bug1157493.pdf).
var diffLength = entry.length, diffBuf = new Array(diffLength);
for (var j = 0; j < diffLength; j++) {
var diffEntry = entry[j];
if (isName(diffEntry)) {
diffBuf[j] = diffEntry.name;
} else if (isNum(diffEntry) || isRef(diffEntry)) {
diffBuf[j] = diffEntry.toString();
}
}
hash.update(diffBuf.join());
}
}
}