diff --git a/fonts.js b/fonts.js index 7ca0daa30..5d77f8980 100755 --- a/fonts.js +++ b/fonts.js @@ -408,6 +408,8 @@ var Font = (function() { var width = widths[unicode]; if (width) charstring.width = width; + else + charstring.width = 0; } } @@ -2067,45 +2069,11 @@ var Type2CFF = (function() { var charName = charsets[i]; var charCode = GlyphsUnicode[charName]; if (charCode) { - var charString = this.parseCharString(charStrings.get(i), - defaultWidth, nominalWidth); - charstrings.push({unicode: charCode, width: charString.width}); + charstrings.push({unicode: charCode, width: 0}); } } return charstrings; }, - parseCharString: function cff_parsecs(bytes, defaultWidth, nominalWidth) { - var pos = 0; - - function parseInt() { - var value = bytes[pos++]; - if (value < 32) - return null; - - if (value <= 246) { - return value - 139; - } else if (value <= 250) { - return ((value - 247) * 256) + bytes[pos++] + 108; - } else if (value <= 254) { - return -((value - 251) * 256) - bytes[pos++] - 108; - } else { - error('Incorrect byte'); - } - }; - - var val = bytes[pos]; - var w; - if (val >= 32 && val <= 254) { - w = parseInt(); - } - - if (w) - w += nominalWidth; - else - w = defaultWidth; - - return {width: w} - }, parseEncoding: function cff_parseencoding(pos) { if (pos == 0) { return Encodings.StandardEncoding; diff --git a/pdf.js b/pdf.js index 8e30858bf..d38f7391f 100644 --- a/pdf.js +++ b/pdf.js @@ -3821,15 +3821,11 @@ var PartialEvaluator = (function() { } var widths = fontDict.get('Widths'); - var firstChar = fontDict.get('FirstChar'); - var lastChar = fontDict.get('LastChar'); if (widths) { - var glyphWidths = []; - for (var i = 0; i < firstChar; ++i) - glyphWidths.push(0); - + var glyphWidths = {}; + var unicode = fontDict.get('FirstChar'); for (var i = 0, ii = widths.length; i < ii; ++i) - glyphWidths.push(widths[i]); + glyphWidths[unicode++] = widths[i]; } var properties = {