diff --git a/src/core/fonts.js b/src/core/fonts.js index 82d47f708..dad5259fb 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -3647,7 +3647,7 @@ var Font = (function FontClosure() { } } - function sanitizeTTPrograms(fpgm, prep) { + function sanitizeTTPrograms(fpgm, prep, cvt) { var ttContext = { functionsDefined: [], functionsUsed: [], @@ -3664,6 +3664,11 @@ var Font = (function FontClosure() { if (fpgm) { checkInvalidFunctions(ttContext, maxFunctionDefs); } + if (cvt && (cvt.length & 1)) { + var cvtData = new Uint8Array(cvt.length + 1); + cvtData.set(cvt.data); + cvt.data = cvtData; + } return ttContext.hintsValid; } @@ -3735,10 +3740,11 @@ var Font = (function FontClosure() { } var hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, - maxFunctionDefs); + tables['cvt '], maxFunctionDefs); if (!hintsValid) { delete tables.fpgm; delete tables.prep; + delete tables['cvt ']; } // Tables needs to be written by ascendant alphabetic order diff --git a/test/pdfs/issue2799.pdf.link b/test/pdfs/issue2799.pdf.link new file mode 100644 index 000000000..72006f6aa --- /dev/null +++ b/test/pdfs/issue2799.pdf.link @@ -0,0 +1 @@ +https://dl.dropboxusercontent.com/s/15j936nuidw0e8d/SIMPLE-Vivace.pdf?token_hash=AAEwO6O_zfDfSxC3Zmpoy_cNfiR109Tn-REcWa32slkaSA&disable_range=1 diff --git a/test/test_manifest.json b/test/test_manifest.json index 5a44154b1..414ef0d16 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1392,6 +1392,14 @@ "rounds": 1, "type": "eq" }, + { "id": "issue2799", + "file": "pdfs/issue2799.pdf", + "md5": "3d3224eae54bbae5fc76224a2af49486", + "rounds": 1, + "lastPage": 1, + "link": true, + "type": "eq" + }, { "id": "issue3025", "file": "pdfs/issue3025.pdf", "md5": "8e4e8eacbd7c4c248deeca0ec49d38da",