used width info in fontDict
This commit is contained in:
parent
8763002c44
commit
c7aec8ac8a
12
fonts.js
12
fonts.js
@ -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
13
pdf.js
@ -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'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user