Skip to content

Commit 796023f

Browse files
committed
Merge pull request mozilla#3007 from brendandahl/delta-encode
Fix encoding of type1 private dictionary arrays.
2 parents 6b33422 + 82eb374 commit 796023f

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
@@ -5684,7 +5684,15 @@ Type1Font.prototype = {
56845684
var field = fields[i];
56855685
if (!properties.privateData.hasOwnProperty(field))
56865686
continue;
5687-
privateDict.setByName(field, properties.privateData[field]);
5687+
var value = properties.privateData[field];
5688+
if (isArray(value)) {
5689+
// All of the private dictionary array data in CFF must be stored as
5690+
// "delta-encoded" numbers.
5691+
for (var j = value.length - 1; j > 0; j--) {
5692+
value[j] -= value[j - 1]; // ... difference from previous value
5693+
}
5694+
}
5695+
privateDict.setByName(field, value);
56885696
}
56895697
cff.topDict.privateDict = privateDict;
56905698

0 commit comments

Comments
 (0)