removed code to parse type2 ccharstrings

This commit is contained in:
sbarman 2011-07-20 14:43:44 -07:00
parent c7aec8ac8a
commit 8824ff9539
2 changed files with 6 additions and 42 deletions

View File

@ -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;

10
pdf.js
View File

@ -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 = {