Merge pull request #3007 from brendandahl/delta-encode
Fix encoding of type1 private dictionary arrays.
This commit is contained in:
commit
796023fca5
10
src/fonts.js
10
src/fonts.js
@ -5684,7 +5684,15 @@ Type1Font.prototype = {
|
||||
var field = fields[i];
|
||||
if (!properties.privateData.hasOwnProperty(field))
|
||||
continue;
|
||||
privateDict.setByName(field, properties.privateData[field]);
|
||||
var value = properties.privateData[field];
|
||||
if (isArray(value)) {
|
||||
// All of the private dictionary array data in CFF must be stored as
|
||||
// "delta-encoded" numbers.
|
||||
for (var j = value.length - 1; j > 0; j--) {
|
||||
value[j] -= value[j - 1]; // ... difference from previous value
|
||||
}
|
||||
}
|
||||
privateDict.setByName(field, value);
|
||||
}
|
||||
cff.topDict.privateDict = privateDict;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user