Skip to content

Commit 82eb374

Browse files
committed
Fix encoding of type1 private dictionary arrays.
1 parent 04f6e17 commit 82eb374

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/fonts.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5616,7 +5616,15 @@ Type1Font.prototype = {
56165616
var field = fields[i];
56175617
if (!properties.privateData.hasOwnProperty(field))
56185618
continue;
5619-
privateDict.setByName(field, properties.privateData[field]);
5619+
var value = properties.privateData[field];
5620+
if (isArray(value)) {
5621+
// All of the private dictionary array data in CFF must be stored as
5622+
// "delta-encoded" numbers.
5623+
for (var j = value.length - 1; j > 0; j--) {
5624+
value[j] -= value[j - 1]; // ... difference from previous value
5625+
}
5626+
}
5627+
privateDict.setByName(field, value);
56205628
}
56215629
cff.topDict.privateDict = privateDict;
56225630

0 commit comments

Comments
 (0)