Merge pull request #6848 from Snuffleupagus/recover-missing-glyf-table
[TrueType] Recover from a missing "glyf" table by replacing it with dummy data, utilizing the existing code in `sanitizeGlyphLocations`
This commit is contained in:
commit
ec066101d8
@ -4154,8 +4154,16 @@ var Font = (function FontClosure() {
|
|||||||
delete tables['cvt '];
|
delete tables['cvt '];
|
||||||
this.isOpenType = true;
|
this.isOpenType = true;
|
||||||
} else {
|
} else {
|
||||||
if (!tables.glyf || !tables.loca) {
|
if (!tables.loca) {
|
||||||
error('Required "glyf" or "loca" tables are not found');
|
error('Required "loca" table is not found');
|
||||||
|
}
|
||||||
|
if (!tables.glyf) {
|
||||||
|
warn('Required "glyf" table is not found -- trying to recover.');
|
||||||
|
// Note: We use `sanitizeGlyphLocations` to add dummy glyf data below.
|
||||||
|
tables.glyf = {
|
||||||
|
tag: 'glyf',
|
||||||
|
data: new Uint8Array(0),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
this.isOpenType = false;
|
this.isOpenType = false;
|
||||||
}
|
}
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -11,6 +11,7 @@
|
|||||||
!issue2391-1.pdf
|
!issue2391-1.pdf
|
||||||
!issue2391-2.pdf
|
!issue2391-2.pdf
|
||||||
!issue4665.pdf
|
!issue4665.pdf
|
||||||
|
!issue4684.pdf
|
||||||
!issue5801.pdf
|
!issue5801.pdf
|
||||||
!issue5946.pdf
|
!issue5946.pdf
|
||||||
!issue5972.pdf
|
!issue5972.pdf
|
||||||
|
BIN
test/pdfs/issue4684.pdf
Normal file
BIN
test/pdfs/issue4684.pdf
Normal file
Binary file not shown.
@ -1789,6 +1789,14 @@
|
|||||||
"type": "eq",
|
"type": "eq",
|
||||||
"about": "Has a multi-byte char codes."
|
"about": "Has a multi-byte char codes."
|
||||||
},
|
},
|
||||||
|
{ "id": "issue4684-text",
|
||||||
|
"file": "pdfs/issue4684.pdf",
|
||||||
|
"md5": "af5056fcdfb08bd7adc1710d36e4b5b5",
|
||||||
|
"link": false,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "text",
|
||||||
|
"about": "Invisible (and broken) TrueType font used for text-selection."
|
||||||
|
},
|
||||||
{ "id": "issue1912",
|
{ "id": "issue1912",
|
||||||
"file": "pdfs/issue1912.pdf",
|
"file": "pdfs/issue1912.pdf",
|
||||||
"md5": "15305b7c2cba971e7423de3f6ad38fef",
|
"md5": "15305b7c2cba971e7423de3f6ad38fef",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user