Take the FirstChar/LastChar properties into account when computing the hash in PartialEvaluator.preEvaluateFont (issue 10665)

Without this some fonts may incorrectly end up with matching `hash`es, thus breaking rendering since we'll not actually try to load/parse some of the fonts.
This commit is contained in:
Jonas Jenwald 2019-03-27 00:25:34 +01:00
parent a2a824ed01
commit 9077abc263
4 changed files with 12 additions and 0 deletions

View File

@ -2350,6 +2350,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} }
} }
const firstChar = (dict.get('FirstChar') || 0);
const lastChar = (dict.get('LastChar') || (composite ? 0xFFFF : 0xFF));
hash.update(`${firstChar}-${lastChar}`);
var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode'); var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
if (isStream(toUnicode)) { if (isStream(toUnicode)) {
var stream = toUnicode.str || toUnicode; var stream = toUnicode.str || toUnicode;

View File

@ -76,6 +76,7 @@
!issue10388_reduced.pdf !issue10388_reduced.pdf
!issue10438_reduced.pdf !issue10438_reduced.pdf
!issue10529.pdf !issue10529.pdf
!issue10665_reduced.pdf
!bad-PageLabels.pdf !bad-PageLabels.pdf
!decodeACSuccessive.pdf !decodeACSuccessive.pdf
!filled-background.pdf !filled-background.pdf

Binary file not shown.

View File

@ -2564,6 +2564,13 @@
"link": false, "link": false,
"type": "eq" "type": "eq"
}, },
{ "id": "issue10665",
"file": "pdfs/issue10665_reduced.pdf",
"md5": "4c8938c808153f6b3840e8a5eb68b804",
"rounds": 1,
"link": false,
"type": "eq"
},
{ "id": "issue1466", { "id": "issue1466",
"file": "pdfs/issue1466.pdf", "file": "pdfs/issue1466.pdf",
"md5": "8a8877432e5bb10cfd50d60488d947bb", "md5": "8a8877432e5bb10cfd50d60488d947bb",