Merge pull request #13347 from Snuffleupagus/preEvaluateFont-composite-widths
Take the `W` array into account when computing the hash, in `PartialEvaluator.preEvaluateFont`, for composite fonts (issue 13343)
This commit is contained in:
commit
e6435e37af
@ -3616,9 +3616,37 @@ class PartialEvaluator {
|
||||
}
|
||||
|
||||
const widths = dict.get("Widths") || baseDict.get("Widths");
|
||||
if (widths) {
|
||||
uint8array = new Uint8Array(new Uint32Array(widths).buffer);
|
||||
hash.update(uint8array);
|
||||
if (Array.isArray(widths)) {
|
||||
const widthsBuf = [];
|
||||
for (const entry of widths) {
|
||||
if (isNum(entry) || isRef(entry)) {
|
||||
widthsBuf.push(entry.toString());
|
||||
}
|
||||
}
|
||||
hash.update(widthsBuf.join());
|
||||
}
|
||||
|
||||
if (composite) {
|
||||
hash.update("compositeFont");
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -313,6 +313,7 @@
|
||||
!noembed-eucjp.pdf
|
||||
!noembed-sjis.pdf
|
||||
!vertical.pdf
|
||||
!issue13343.pdf
|
||||
!ZapfDingbats.pdf
|
||||
!bug878026.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,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue13343",
|
||||
"file": "pdfs/issue13343.pdf",
|
||||
"md5": "f8bf1888839e15254555092c504e1900",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "bug921760",
|
||||
"file": "pdfs/bug921760.pdf",
|
||||
"md5": "1aa136d786a65b0d7cce7bdb3c58c6c3",
|
||||
|
Loading…
Reference in New Issue
Block a user