mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 06:38:07 +02:00
Merge pull request #19639 from calixteman/issue19633
Always use the absolute value of the line thickness (issue 19633)
This commit is contained in:
commit
391e84c34b
4 changed files with 26 additions and 0 deletions
|
@ -1122,6 +1122,12 @@ class PartialEvaluator {
|
|||
case "Type":
|
||||
break;
|
||||
case "LW":
|
||||
if (typeof value !== "number") {
|
||||
warn(`Invalid LW (line width): ${value}`);
|
||||
break;
|
||||
}
|
||||
gStateObj.push([key, Math.abs(value)]);
|
||||
break;
|
||||
case "LC":
|
||||
case "LJ":
|
||||
case "ML":
|
||||
|
@ -2212,6 +2218,18 @@ class PartialEvaluator {
|
|||
})
|
||||
);
|
||||
return;
|
||||
case OPS.setLineWidth: {
|
||||
// The thickness should be a non-negative number, as per spec.
|
||||
// When the value is negative, Acrobat and Poppler take the absolute
|
||||
// value while PDFium takes the max of 0 and the value.
|
||||
const [thickness] = args;
|
||||
if (typeof thickness !== "number") {
|
||||
warn(`Invalid setLineWidth: ${thickness}`);
|
||||
continue;
|
||||
}
|
||||
args[0] = Math.abs(thickness);
|
||||
break;
|
||||
}
|
||||
case OPS.moveTo:
|
||||
case OPS.lineTo:
|
||||
case OPS.curveTo:
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -711,3 +711,4 @@
|
|||
!issue19505.pdf
|
||||
!colors.pdf
|
||||
!red_stamp.pdf
|
||||
!issue19633.pdf
|
||||
|
|
BIN
test/pdfs/issue19633.pdf
Executable file
BIN
test/pdfs/issue19633.pdf
Executable file
Binary file not shown.
|
@ -11971,5 +11971,12 @@
|
|||
"rounds": 1,
|
||||
"link": true,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue19633",
|
||||
"file": "pdfs/issue19633.pdf",
|
||||
"md5": "9993aa298c0214a3d3ff5f90ce0d40bb",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue