Fix loca table when offsets aren't in ascending order.

This commit is contained in:
Brendan Dahl 2017-12-13 18:10:14 -06:00
parent b327633ad6
commit 9b51cea724
4 changed files with 12 additions and 0 deletions

View File

@ -1759,6 +1759,11 @@ var Font = (function FontClosure() {
var locaCount = dupFirstEntry ? numGlyphs - 1 : numGlyphs;
for (i = 0, j = itemSize; i < locaCount; i++, j += itemSize) {
var endOffset = itemDecode(locaData, j);
// The spec says the offsets should be in ascending order, however
// some fonts use the offset of 0 to mark a glyph as missing.
if (endOffset === 0) {
endOffset = startOffset;
}
if (endOffset > oldGlyfDataLength &&
((oldGlyfDataLength + 3) & ~3) === endOffset) {
// Aspose breaks fonts by aligning the glyphs to the qword, but not

View File

@ -114,6 +114,7 @@
!issue6541.pdf
!issue2948.pdf
!issue6231_1.pdf
!issue7074_reduced.pdf
!issue6413.pdf
!issue4630.pdf
!issue4909.pdf

Binary file not shown.

View File

@ -2715,6 +2715,12 @@
"rounds": 1,
"type": "load"
},
{ "id": "issue7074_reduced",
"file": "pdfs/issue7074_reduced.pdf",
"md5": "46893f8aa33620a05acdc27e3b79469d",
"rounds": 1,
"type": "eq"
},
{ "id": "issue5540",
"file": "pdfs/issue5540.pdf",
"md5": "12b69b19e366232422812ad8b2534f37",