Fixes creation of OS/2 table
This commit is contained in:
parent
bf0abd61d1
commit
aa93eac261
29
src/fonts.js
29
src/fonts.js
@ -2646,24 +2646,24 @@ var Font = (function FontClosure() {
|
||||
lastCharIndex = 255;
|
||||
}
|
||||
|
||||
var unitsPerEm = override.unitsPerEm || PDF_GLYPH_SPACE_UNITS;
|
||||
var typoAscent = override.ascent || properties.ascent;
|
||||
var typoDescent = override.descent || properties.descent;
|
||||
var winAscent = override.yMax || typoAscent;
|
||||
var winDescent = -override.yMin || -typoDescent;
|
||||
var bbox = properties.bbox || [0, 0, 0, 0];
|
||||
var unitsPerEm = override.unitsPerEm ||
|
||||
1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
|
||||
|
||||
// if there is a units per em value but no other override
|
||||
// then scale the calculated ascent
|
||||
if (unitsPerEm != PDF_GLYPH_SPACE_UNITS &&
|
||||
'undefined' == typeof(override.ascent)) {
|
||||
// if the font units differ to the PDF glyph space units
|
||||
// then scale up the values
|
||||
typoAscent = Math.round(typoAscent * unitsPerEm / PDF_GLYPH_SPACE_UNITS);
|
||||
typoDescent = Math.round(typoDescent * unitsPerEm /
|
||||
PDF_GLYPH_SPACE_UNITS);
|
||||
winAscent = typoAscent;
|
||||
winDescent = -typoDescent;
|
||||
var scale = properties.ascentScaled ? 1.0 :
|
||||
unitsPerEm / PDF_GLYPH_SPACE_UNITS;
|
||||
|
||||
var typoAscent = override.ascent || Math.round(scale *
|
||||
(properties.ascent || bbox[3]));
|
||||
var typoDescent = override.descent || Math.round(scale *
|
||||
(properties.descent || bbox[1]));
|
||||
if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
|
||||
typoDescent = -typoDescent; // fixing incorrect descent
|
||||
}
|
||||
var winAscent = override.yMax || typoAscent;
|
||||
var winDescent = -override.yMin || -typoDescent;
|
||||
|
||||
return '\x00\x03' + // version
|
||||
'\x02\x24' + // xAvgCharWidth
|
||||
@ -5479,6 +5479,7 @@ var CFFParser = (function CFFParserClosure() {
|
||||
// adjusting ascent/descent
|
||||
properties.ascent = fontBBox[3];
|
||||
properties.descent = fontBBox[1];
|
||||
properties.ascentScaled = true;
|
||||
}
|
||||
|
||||
var charset, encoding;
|
||||
|
Loading…
Reference in New Issue
Block a user