Take the W
array into account when computing the hash, in PartialEvaluator.preEvaluateFont
, for composite fonts (issue 13343)
Without this some *composite* 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. *Please note:* Given that the document, in the referenced issue, doesn't embed *any* of its fonts there's no guarantee that it renders correctly in all configurations even with this patch.
This commit is contained in:
parent
a2652bafd9
commit
fc59a5f709
@ -3620,6 +3620,27 @@ class PartialEvaluator {
|
|||||||
uint8array = new Uint8Array(new Uint32Array(widths).buffer);
|
uint8array = new Uint8Array(new Uint32Array(widths).buffer);
|
||||||
hash.update(uint8array);
|
hash.update(uint8array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (composite) {
|
||||||
|
const compositeWidths = dict.get("W") || baseDict.get("W");
|
||||||
|
if (Array.isArray(compositeWidths)) {
|
||||||
|
const widthsBuf = [];
|
||||||
|
for (const entry of compositeWidths) {
|
||||||
|
if (isNum(entry) || isRef(entry)) {
|
||||||
|
widthsBuf.push(entry.toString());
|
||||||
|
} else if (Array.isArray(entry)) {
|
||||||
|
const subWidthsBuf = [];
|
||||||
|
for (const element of entry) {
|
||||||
|
if (isNum(element) || isRef(element)) {
|
||||||
|
subWidthsBuf.push(element.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
widthsBuf.push(`[${subWidthsBuf.join()}]`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hash.update(widthsBuf.join());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -313,6 +313,7 @@
|
|||||||
!noembed-eucjp.pdf
|
!noembed-eucjp.pdf
|
||||||
!noembed-sjis.pdf
|
!noembed-sjis.pdf
|
||||||
!vertical.pdf
|
!vertical.pdf
|
||||||
|
!issue13343.pdf
|
||||||
!ZapfDingbats.pdf
|
!ZapfDingbats.pdf
|
||||||
!bug878026.pdf
|
!bug878026.pdf
|
||||||
!issue1045.pdf
|
!issue1045.pdf
|
||||||
|
BIN
test/pdfs/issue13343.pdf
Normal file
BIN
test/pdfs/issue13343.pdf
Normal file
Binary file not shown.
@ -132,6 +132,12 @@
|
|||||||
"link": false,
|
"link": false,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue13343",
|
||||||
|
"file": "pdfs/issue13343.pdf",
|
||||||
|
"md5": "f8bf1888839e15254555092c504e1900",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "bug921760",
|
{ "id": "bug921760",
|
||||||
"file": "pdfs/bug921760.pdf",
|
"file": "pdfs/bug921760.pdf",
|
||||||
"md5": "1aa136d786a65b0d7cce7bdb3c58c6c3",
|
"md5": "1aa136d786a65b0d7cce7bdb3c58c6c3",
|
||||||
|
Loading…
Reference in New Issue
Block a user