[pango/matthiasc/for-main: 14/15] carets: Fix rect for negative slopes




commit c2bb4548c4864ecbf62daca65b2e833615bc1579
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 27 17:08:30 2021 -0400

    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.

 pango/pango-layout.c | 4 ++++
 1 file changed, 4 insertions(+)
---
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;
         }
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]