diff --git a/src/core/fonts.js b/src/core/fonts.js index 97f387bcf..15f41cdff 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -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 diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index da8d0c29e..6ec4eeb40 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -114,6 +114,7 @@ !issue6541.pdf !issue2948.pdf !issue6231_1.pdf +!issue7074_reduced.pdf !issue6413.pdf !issue4630.pdf !issue4909.pdf diff --git a/test/pdfs/issue7074_reduced.pdf b/test/pdfs/issue7074_reduced.pdf new file mode 100644 index 000000000..64e0c72fe Binary files /dev/null and b/test/pdfs/issue7074_reduced.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 2788419a5..8c8a85eea 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -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",