1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

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