Fix loca table when offsets aren't in ascending order.
This commit is contained in:
parent
b327633ad6
commit
9b51cea724
@ -1759,6 +1759,11 @@ var Font = (function FontClosure() {
|
|||||||
var locaCount = dupFirstEntry ? numGlyphs - 1 : numGlyphs;
|
var locaCount = dupFirstEntry ? numGlyphs - 1 : numGlyphs;
|
||||||
for (i = 0, j = itemSize; i < locaCount; i++, j += itemSize) {
|
for (i = 0, j = itemSize; i < locaCount; i++, j += itemSize) {
|
||||||
var endOffset = itemDecode(locaData, j);
|
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 &&
|
if (endOffset > oldGlyfDataLength &&
|
||||||
((oldGlyfDataLength + 3) & ~3) === endOffset) {
|
((oldGlyfDataLength + 3) & ~3) === endOffset) {
|
||||||
// Aspose breaks fonts by aligning the glyphs to the qword, but not
|
// Aspose breaks fonts by aligning the glyphs to the qword, but not
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -114,6 +114,7 @@
|
|||||||
!issue6541.pdf
|
!issue6541.pdf
|
||||||
!issue2948.pdf
|
!issue2948.pdf
|
||||||
!issue6231_1.pdf
|
!issue6231_1.pdf
|
||||||
|
!issue7074_reduced.pdf
|
||||||
!issue6413.pdf
|
!issue6413.pdf
|
||||||
!issue4630.pdf
|
!issue4630.pdf
|
||||||
!issue4909.pdf
|
!issue4909.pdf
|
||||||
|
BIN
test/pdfs/issue7074_reduced.pdf
Normal file
BIN
test/pdfs/issue7074_reduced.pdf
Normal file
Binary file not shown.
@ -2715,6 +2715,12 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue7074_reduced",
|
||||||
|
"file": "pdfs/issue7074_reduced.pdf",
|
||||||
|
"md5": "46893f8aa33620a05acdc27e3b79469d",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue5540",
|
{ "id": "issue5540",
|
||||||
"file": "pdfs/issue5540.pdf",
|
"file": "pdfs/issue5540.pdf",
|
||||||
"md5": "12b69b19e366232422812ad8b2534f37",
|
"md5": "12b69b19e366232422812ad8b2534f37",
|
||||||
|
Loading…
Reference in New Issue
Block a user