used width info in fontDict

This commit is contained in:
sbarman 2011-07-20 12:57:47 -07:00
parent 8763002c44
commit c7aec8ac8a
2 changed files with 25 additions and 0 deletions

View File

@ -399,6 +399,18 @@ var Font = (function() {
var cff = new CFF(name, file, properties);
}
var widths = properties.glyphWidths;
if (widths) {
var charstrings = cff.charstrings;
for (var i = 0, ii = charstrings.length; i < ii; ++i) {
var charstring = charstrings[i];
var unicode = charstring.unicode;
var width = widths[unicode];
if (width)
charstring.width = width;
}
}
// Wrap the CFF data inside an OTF font file
data = this.convert(name, cff, properties);
break;

13
pdf.js
View File

@ -3820,9 +3820,22 @@ var PartialEvaluator = (function() {
fileType = fileType.name;
}
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);
for (var i = 0, ii = widths.length; i < ii; ++i)
glyphWidths.push(widths[i]);
}
var properties = {
type: subType.name,
subtype: fileType,
glyphWidths: glyphWidths,
encoding: encodingMap,
charset: charset,
firstChar: fontDict.get('FirstChar'),