summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-27 17:08:30 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-27 17:08:30 -0400
commitc2bb4548c4864ecbf62daca65b2e833615bc1579 (patch)
tree298fccb8131e2fd481203b3df2f7ee163cfb2394
parentd0ff45ecf45b4f81d5d05e545a36a885b6a33b7a (diff)
downloadpango-c2bb4548c4864ecbf62daca65b2e833615bc1579.tar.gz
carets: Fix rect for negative slopes
The intention was to flip the rectangle horizontally. We do return a negative width, but we forgot to flip the origin.
-rw-r--r--pango/pango-layout.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index f88581f1..ac396ba0 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2718,12 +2718,16 @@ pango_layout_get_caret_pos (PangoLayout *layout,
{
strong_pos->x += descender * slope_inv;
strong_pos->width = strong_pos->height * slope_inv;
+ if (slope_inv < 0)
+ strong_pos->x -= strong_pos->width;
}
if (weak_pos)
{
weak_pos->x += descender * slope_inv;
weak_pos->width = weak_pos->height * slope_inv;
+ if (slope_inv < 0)
+ weak_pos->x -= weak_pos->width;
}
}
}