[pango/matthiasc/for-main: 36/36] Avoid overflow when calculating caret slope
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/matthiasc/for-main: 36/36] Avoid overflow when calculating caret slope
- Date: Tue, 21 Jun 2022 18:09:01 +0000 (UTC)
commit 0edd33e9ddf8df1dab98bee5fdc7c4c3fd0d0c03
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jun 21 11:06:38 2022 -0700
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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]