From 0edd33e9ddf8df1dab98bee5fdc7c4c3fd0d0c03 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 21 Jun 2022 11:06:38 -0700 Subject: Avoid overflow when calculating caret slope This showed up as wrong slopes with font size > 60. --- pango/pango-layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 2b03ee2c..165c6a7f 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -2729,7 +2729,7 @@ pango_layout_get_caret_pos (PangoLayout *layout, return; hb_font_get_scale (hb_font, &x_scale, &y_scale); - slope_inv = (caret_run * y_scale) / (double) (caret_rise * x_scale); + slope_inv = (caret_run / (double) caret_rise) * (y_scale / (double) x_scale); if (strong_pos) { -- cgit v1.2.1