From 82eb374fad442b9b11dc23a8139c3b404df0120d Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Thu, 28 Mar 2013 15:05:03 -0700 Subject: [PATCH] Fix encoding of type1 private dictionary arrays. --- src/fonts.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fonts.js b/src/fonts.js index 3c25e7ddd..a7a502c17 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -5616,7 +5616,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;