Skip to content

Commit ec635b8

Browse files
Merge pull request #12044 from Snuffleupagus/issue-12010
Adjust the heuristics used when dealing with rectangles, i.e. `re` operators, with zero width/height (issue 12010)
2 parents 75fed02 + fef2465 commit ec635b8

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

src/display/canvas.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1185,20 +1185,20 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
11851185
y = args[j++];
11861186
var width = args[j++];
11871187
var height = args[j++];
1188-
if (width === 0) {
1188+
if (width === 0 && ctx.lineWidth < this.getSinglePixelWidth()) {
11891189
width = this.getSinglePixelWidth();
11901190
}
1191-
if (height === 0) {
1191+
if (height === 0 && ctx.lineWidth < this.getSinglePixelWidth()) {
11921192
height = this.getSinglePixelWidth();
11931193
}
11941194
var xw = x + width;
11951195
var yh = y + height;
1196-
this.ctx.moveTo(x, y);
1197-
this.ctx.lineTo(xw, y);
1198-
this.ctx.lineTo(xw, yh);
1199-
this.ctx.lineTo(x, yh);
1200-
this.ctx.lineTo(x, y);
1201-
this.ctx.closePath();
1196+
ctx.moveTo(x, y);
1197+
ctx.lineTo(xw, y);
1198+
ctx.lineTo(xw, yh);
1199+
ctx.lineTo(x, yh);
1200+
ctx.lineTo(x, y);
1201+
ctx.closePath();
12021202
break;
12031203
case OPS.moveTo:
12041204
x = args[j++];

test/pdfs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@
262262
!bug903856.pdf
263263
!bug850854.pdf
264264
!bug866395.pdf
265+
!issue12010_reduced.pdf
265266
!issue11718_reduced.pdf
266267
!bug1027533.pdf
267268
!bug1028735.pdf

test/pdfs/issue12010_reduced.pdf

795 Bytes
Binary file not shown.

test/test_manifest.json

+6
Original file line numberDiff line numberDiff line change
@@ -2727,6 +2727,12 @@
27272727
"link": false,
27282728
"type": "eq"
27292729
},
2730+
{ "id": "issue12010",
2731+
"file": "pdfs/issue12010_reduced.pdf",
2732+
"md5": "8894ec63069dcf92c9f56baec05c0425",
2733+
"rounds": 1,
2734+
"type": "eq"
2735+
},
27302736
{ "id": "issue7598",
27312737
"file": "pdfs/issue7598.pdf",
27322738
"md5": "c5bc5a779bfcb4b234f853231b56cf60",

0 commit comments

Comments
 (0)