Always use the absolute value of the line thickness (issue 19633)
This commit is contained in:
parent
d008452e80
commit
4b4f85484e
@ -1122,6 +1122,12 @@ class PartialEvaluator {
|
|||||||
case "Type":
|
case "Type":
|
||||||
break;
|
break;
|
||||||
case "LW":
|
case "LW":
|
||||||
|
if (typeof value !== "number") {
|
||||||
|
warn(`Invalid LW (line width): ${value}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gStateObj.push([key, Math.abs(value)]);
|
||||||
|
break;
|
||||||
case "LC":
|
case "LC":
|
||||||
case "LJ":
|
case "LJ":
|
||||||
case "ML":
|
case "ML":
|
||||||
@ -2212,6 +2218,18 @@ class PartialEvaluator {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
return;
|
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.moveTo:
|
||||||
case OPS.lineTo:
|
case OPS.lineTo:
|
||||||
case OPS.curveTo:
|
case OPS.curveTo:
|
||||||
|
|||||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -711,3 +711,4 @@
|
|||||||
!issue19505.pdf
|
!issue19505.pdf
|
||||||
!colors.pdf
|
!colors.pdf
|
||||||
!red_stamp.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,
|
"rounds": 1,
|
||||||
"link": true,
|
"link": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "issue19633",
|
||||||
|
"file": "pdfs/issue19633.pdf",
|
||||||
|
"md5": "9993aa298c0214a3d3ff5f90ce0d40bb",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user