diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 474f29788..58580855e 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -3661,8 +3661,24 @@ class PartialEvaluator { if (baseEncodingName) { properties.defaultEncoding = getEncoding(baseEncodingName); } else { - const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); + let isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); const isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic); + + // The PDF specs state that the flags Symbolic and Nonsymbolic must be + // mutually exclusive. However, some fonts are marked as both. + // In that case we ignore the Symbolic flag when there is a Differences + // entry (which indicates that the font is used as a non-symbolic + // font). + if ( + properties.type === "TrueType" && + isSymbolicFont && + isNonsymbolicFont && + differences.length !== 0 + ) { + properties.flags &= ~FontFlags.Symbolic; + isSymbolicFont = false; + } + // According to "Table 114" in section "9.6.6.1 General" (under // "9.6.6 Character Encoding") of the PDF specification, a Nonsymbolic // font should use the `StandardEncoding` if no encoding is specified. diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 4ba07c109..781516bde 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -743,3 +743,4 @@ !tracemonkey_with_editable_annotations.pdf !bug1980958.pdf !tracemonkey_annotation_on_page_8.pdf +!issue20232.pdf diff --git a/test/pdfs/issue20232.pdf b/test/pdfs/issue20232.pdf new file mode 100644 index 000000000..b3af724a9 Binary files /dev/null and b/test/pdfs/issue20232.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 90f5883a0..6a810a98c 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -13020,5 +13020,12 @@ "md5": "ae4f643ee9bb0fd725277a9d1e0fb1df", "rounds": 1, "type": "load" + }, + { + "id": "issue20232", + "file": "pdfs/issue20232.pdf", + "md5": "cc53e96a8fd9eafbfbb74de564f37047", + "rounds": 1, + "type": "eq" } ]