Merge pull request #8060 from a0preetham/font_ascent_fix

Font ascent descent calculation fix
This commit is contained in:
Jonas Jenwald 2017-02-11 13:32:04 +01:00 committed by GitHub
commit 7be8bd9f96
5 changed files with 11 additions and 4 deletions

View File

@ -257,8 +257,8 @@ var CFFParser = (function CFFParserClosure() {
var fontBBox = topDict.getByName('FontBBox');
if (fontBBox) {
// adjusting ascent/descent
properties.ascent = fontBBox[3];
properties.descent = fontBBox[1];
properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
properties.descent = Math.min(fontBBox[1], fontBBox[3]);
properties.ascentScaled = true;
}

View File

@ -705,8 +705,8 @@ var Type1Parser = (function Type1ParserClosure() {
case 'FontBBox':
var fontBBox = this.readNumberArray();
// adjusting ascent/descent
properties.ascent = fontBBox[3];
properties.descent = fontBBox[1];
properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
properties.descent = Math.min(fontBBox[1], fontBBox[3]);
properties.ascentScaled = true;
break;
}

View File

@ -271,3 +271,4 @@
!zero_descent.pdf
!operator-in-TJ-array.pdf
!issue7878.pdf
!font_ascent_descent.pdf

BIN
test/pdfs/font_ascent_descent.pdf Executable file

Binary file not shown.

View File

@ -3367,5 +3367,11 @@
"link": false,
"rounds": 1,
"type": "text"
},
{ "id": "font_ascent_descent",
"file": "pdfs/font_ascent_descent.pdf",
"md5": "c0048a7735010002b998c112335e47bf",
"rounds": 1,
"type": "eq"
}
]