From 5973d40afe5a1f82474438caae71c4039dc3ba84 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Thu, 2 Jan 2014 18:44:11 -0600 Subject: [PATCH] Adjusts heuristic for disabling Symbol encoding --- src/core/evaluator.js | 7 +-- test/pdfs/.gitattributes | 1 + test/pdfs/.gitignore | 1 + test/pdfs/bug864847.pdf | 98 ++++++++++++++++++++++++++++++++++++++++ test/test_manifest.json | 6 +++ 5 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 test/pdfs/.gitattributes create mode 100644 test/pdfs/bug864847.pdf diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 56f947c91..5f2047d00 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -982,10 +982,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { Encodings.WinAnsiEncoding : Encodings.StandardEncoding; // The Symbolic attribute can be misused for regular fonts - // Heuristic: we have to check if the font is a standard one also + // Heuristic: we have to check if the font is a standard one or + // toUnicode is provided if (!!(flags & FontFlags.Symbolic)) { - baseEncoding = !properties.file ? Encodings.SymbolSetEncoding : - Encodings.MacRomanEncoding; + baseEncoding = !properties.file && !properties.toUnicode ? + Encodings.SymbolSetEncoding : Encodings.MacRomanEncoding; } if (dict.has('Encoding')) { var encoding = dict.get('Encoding'); diff --git a/test/pdfs/.gitattributes b/test/pdfs/.gitattributes new file mode 100644 index 000000000..d72fd520b --- /dev/null +++ b/test/pdfs/.gitattributes @@ -0,0 +1 @@ +*.pdf binary diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 76685349d..1cb5fbecc 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -44,6 +44,7 @@ !helloworld-bad.pdf !zerowidthline.pdf !bug868745.pdf +!bug864847.pdf !issue1002.pdf !issue925.pdf !gradientfill.pdf diff --git a/test/pdfs/bug864847.pdf b/test/pdfs/bug864847.pdf new file mode 100644 index 000000000..21bba8076 --- /dev/null +++ b/test/pdfs/bug864847.pdf @@ -0,0 +1,98 @@ +%PDF-1.7 + +1 0 obj % entry point +<< + /Type /Catalog + /Pages 2 0 R +>> +endobj + +2 0 obj +<< + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj + +3 0 obj +<< + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + >> + >> + /Contents 5 0 R +>> +endobj +6 0 obj +<< +/Filter /LZWDecode +/Length 192 +>> +stream + d!$i:S2LƓqe9Χ#@b2‡@d42 ,ͦ*M'e3Ms8m2C̞$f&a&9< 1| +2LuH^[&\V+{L[2sJ5 @cID8Sf,^3A@@ +endstream +endobj +7 0 obj +<< +/FontName /Arial-ItalicMT +/StemV 93 +/Ascent 625 +/Flags 4 + /Descent 0 +/ItalicAngle 0 +/MissingWidth 750 +/FontBBox [0 0 625 625] +/Type /FontDescriptor +/CapHeight 625 +>> +endobj +4 0 obj +<< +/BaseFont /Arial-ItalicMT +/LastChar 32 +/Subtype /TrueType +/ToUnicode 6 0 R +/FontDescriptor 7 0 R +/Widths [278] +/Type /Font +/FirstChar 32 +>> +endobj + +5 0 obj % page content +<< + /Length 44 +>> +stream +BT +70 50 TD +/F1 12 Tf +(Hello, 864847) Tj +ET +endstream +endobj + +xref +0 8 +0000000000 65535 f +0000000010 00000 n +0000000079 00000 n +0000000173 00000 n +0000000753 00000 n +0000000913 00000 n +0000000300 00000 n +0000000565 00000 n +trailer +<< + /Size 8 + /Root 1 0 R +>> +startxref +1025 +%%EOF \ No newline at end of file diff --git a/test/test_manifest.json b/test/test_manifest.json index a3d386b85..e0a6b34ad 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -769,6 +769,12 @@ "rounds": 1, "type": "eq" }, + { "id": "bug864847", + "file": "pdfs/bug864847.pdf", + "md5": "2b62cbba5d40a769be8e611eb5b61bfe", + "rounds": 1, + "type": "eq" + }, { "id": "issue925", "file": "pdfs/issue925.pdf", "md5": "f58fe943090aff89dcc8e771bc0db4c2",