Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TrueType] Recover from a missing "glyf" table by replacing it with dummy data, utilizing the existing code in sanitizeGlyphLocations #6848

Merged
merged 1 commit into from
Jan 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/core/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4154,8 +4154,16 @@ var Font = (function FontClosure() {
delete tables['cvt '];
this.isOpenType = true;
} else {
if (!tables.glyf || !tables.loca) {
error('Required "glyf" or "loca" tables are not found');
if (!tables.loca) {
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;
}
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
!issue2391-1.pdf
!issue2391-2.pdf
!issue4665.pdf
!issue4684.pdf
!issue5801.pdf
!issue5946.pdf
!issue5972.pdf
Expand Down
Binary file added test/pdfs/issue4684.pdf
Binary file not shown.
8 changes: 8 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,14 @@
"type": "eq",
"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",
"file": "pdfs/issue1912.pdf",
"md5": "15305b7c2cba971e7423de3f6ad38fef",
Expand Down