From e4c8121ed46b4c91886a2ee9ce35297cb34c1875 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Sat, 13 Oct 2012 11:41:44 -0500 Subject: [PATCH] Suppresses useless for PDF rendering font tables --- src/fonts.js | 6 ++++++ test/pdfs/issue1233.pdf.link | 1 + test/test_manifest.json | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 test/pdfs/issue1233.pdf.link diff --git a/src/fonts.js b/src/fonts.js index 17d847a8d..8ea308b2e 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -3227,6 +3227,9 @@ var Font = (function FontClosure() { var requiredTables = ['OS/2', 'cmap', 'head', 'hhea', 'hmtx', 'maxp', 'name', 'post']; + var optionalTables = ['cvt ', 'fpgm', 'glyf', 'loca', 'prep', + 'CFF ', 'VORG', 'vhea', 'vmtx']; + var header = readOpenTypeHeader(font); var numTables = header.numTables; @@ -3252,6 +3255,9 @@ var Font = (function FontClosure() { os2 = table; requiredTables.splice(index, 1); + } else if (optionalTables.indexOf(table.tag) < 0) { + // skipping table if it's not a required or optional table + continue; } else { if (table.tag == 'vmtx') vmtx = table; diff --git a/test/pdfs/issue1233.pdf.link b/test/pdfs/issue1233.pdf.link new file mode 100644 index 000000000..66c9bc7da --- /dev/null +++ b/test/pdfs/issue1233.pdf.link @@ -0,0 +1 @@ +http://princexml.com/samples/math.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index e8cac9a20..3e54bfd54 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -602,6 +602,14 @@ "link": true, "type": "eq" }, + { "id": "issue1233", + "file": "pdfs/issue1233.pdf", + "md5": "2d3565b0a286e29955796c37c66326c1", + "rounds": 1, + "pageLimit": 1, + "link": true, + "type": "eq" + }, { "id": "issue1243", "file": "pdfs/issue1243.pdf", "md5": "130c849b83513d5ac5e03c6421fc7489",