diff --git a/src/core/fonts.js b/src/core/fonts.js index cdb08c74b..e20dad92c 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -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; } diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index fe8e207ee..d1d8cf0bc 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -10,6 +10,7 @@ !issue2391-1.pdf !issue2391-2.pdf !issue4665.pdf +!issue4684.pdf !issue5801.pdf !issue5946.pdf !issue5972.pdf diff --git a/test/pdfs/issue4684.pdf b/test/pdfs/issue4684.pdf new file mode 100644 index 000000000..b2c15f09b Binary files /dev/null and b/test/pdfs/issue4684.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index c62dda6d9..00460e3ee 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -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",