Merge pull request #20270 from calixteman/issue20232
Consider a ttf font with both Symbolic and Nonsymbolic flags set with a Differences array in the encoding dict as non-symbolic
This commit is contained in:
commit
adf9233f46
@ -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.
|
||||
|
||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -743,3 +743,4 @@
|
||||
!tracemonkey_with_editable_annotations.pdf
|
||||
!bug1980958.pdf
|
||||
!tracemonkey_annotation_on_page_8.pdf
|
||||
!issue20232.pdf
|
||||
|
||||
BIN
test/pdfs/issue20232.pdf
Normal file
BIN
test/pdfs/issue20232.pdf
Normal file
Binary file not shown.
@ -13020,5 +13020,12 @@
|
||||
"md5": "ae4f643ee9bb0fd725277a9d1e0fb1df",
|
||||
"rounds": 1,
|
||||
"type": "load"
|
||||
},
|
||||
{
|
||||
"id": "issue20232",
|
||||
"file": "pdfs/issue20232.pdf",
|
||||
"md5": "cc53e96a8fd9eafbfbb74de564f37047",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
}
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user