From 84b4f53ed60432b85cb1d63f085160d4302925ea Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Fri, 18 May 2012 11:14:09 -0500 Subject: [PATCH] Adjusts MacRoman switch heuristics threshold --- src/fonts.js | 6 +++--- test/pdfs/issue1709.pdf.link | 1 + test/test_manifest.json | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 test/pdfs/issue1709.pdf.link diff --git a/src/fonts.js b/src/fonts.js index 22037e724..9e4189462 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -1976,9 +1976,9 @@ var Font = (function FontClosure() { this.isSymbolicFont = false; } - // heuristics: if removed more than 2 glyphs encoding WinAnsiEncoding - // does not set properly - if (glyphsRemoved > 2) { + // heuristics: if removed more than 10 glyphs encoding WinAnsiEncoding + // does not set properly (broken PDFs have about 100 removed glyphs) + if (glyphsRemoved > 10) { warn('Switching TrueType encoding to MacRomanEncoding for ' + this.name + ' font'); encoding = Encodings.MacRomanEncoding; diff --git a/test/pdfs/issue1709.pdf.link b/test/pdfs/issue1709.pdf.link new file mode 100644 index 000000000..ca5121b2d --- /dev/null +++ b/test/pdfs/issue1709.pdf.link @@ -0,0 +1 @@ +http://www.mft-online.de/files/medizinerreport_2012.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 5ec9e850f..3caaf3bd4 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -402,6 +402,14 @@ "link": true, "type": "eq" }, + { "id": "issue1709", + "file": "pdfs/issue1709.pdf", + "md5": "84497bd23b7c82d03d2681a1cb1d9ed0", + "rounds": 1, + "pageLimit": 10, + "link": true, + "type": "eq" + }, { "id": "issue1015", "file": "pdfs/issue1015.pdf", "md5": "b61503d1b445742b665212866afb60e2",