summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2017-09-17 13:29:18 (GMT)
committerfvogel <fvogelnew1@free.fr>2017-09-17 13:29:18 (GMT)
commit277c3925430a1414c93b53c38f7f37db0326bc02 (patch)
treefddfc329847282b2cd3f7cb36a565d9ef6da76fe
parent28ecd1d8e1c3f719e76cf10280c207b62dcd3769 (diff)
downloadtk-277c3925430a1414c93b53c38f7f37db0326bc02.zip
tk-277c3925430a1414c93b53c38f7f37db0326bc02.tar.gz
tk-277c3925430a1414c93b53c38f7f37db0326bc02.tar.bz2
Fix [514ff64dd0]: canvas rotated text overlap detection not workingbug_514ff64dd0
-rw-r--r--generic/tkFont.c14
-rw-r--r--tests/font.test10
2 files changed, 16 insertions, 8 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 4183686..86fdd87 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -3151,14 +3151,13 @@ TkIntersectAngledTextLayout(
cy[0] = cy[1] = chunkPtr->y - fontPtr->fm.ascent;
cx[1] = cx[2] = chunkPtr->x + chunkPtr->displayWidth;
cy[2] = cy[3] = chunkPtr->y + fontPtr->fm.descent;
- if ( !PointInQuadrilateral(cx, cy, rx[0], ry[0]) ||
- !PointInQuadrilateral(cx, cy, rx[1], ry[1]) ||
- !PointInQuadrilateral(cx, cy, rx[2], ry[2]) ||
- !PointInQuadrilateral(cx, cy, rx[3], ry[3])) {
- goto notReverseInside;
- }
+ if ( PointInQuadrilateral(cx, cy, rx[0], ry[0]) &&
+ PointInQuadrilateral(cx, cy, rx[1], ry[1]) &&
+ PointInQuadrilateral(cx, cy, rx[2], ry[2]) &&
+ PointInQuadrilateral(cx, cy, rx[3], ry[3])) {
+ return 0;
+ }
}
- return 0;
/*
* If we're overlapping now, we must be partially in and out of at least
@@ -3166,7 +3165,6 @@ TkIntersectAngledTextLayout(
* rectangle that is touching or crossing a line segment of a chunk.
*/
- notReverseInside:
chunkPtr = layoutPtr->chunks;
for (i=0 ; i<layoutPtr->numChunks ; i++,chunkPtr++) {
diff --git a/tests/font.test b/tests/font.test
index 23e09c4..62afa5a 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -1956,6 +1956,16 @@ test font-31.6 {Tk_IntersectTextLayout procedure: ignore spaces at eol} -body {
.t.c itemconfig text -width 0
return $x
} -result {}
+test font-31.7 {TkIntersectAngledTextLayout procedure: bug [514ff64dd0]} -body {
+ csetup "This is line one\nand line two\nand line three here"
+ .t.c itemconfigure text -angle 90
+ # Coordinates of the rectangle to check can be hardcoded:
+ # The goal of this test is to check whether the overlap detection algorithm
+ # works when the rectangle is entirely included in a chunk of the text layout.
+ # The text has been rotated 90 degrees around it's upper left corner,
+ # so it's enough to check with a small rectangle with small negative y coords.
+ .t.c find overlapping 5 -7 7 -5
+} -result {1}
destroy .t.c