[pango/pango2: 154/168] Avoid overflow when calculating caret slope
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 154/168] Avoid overflow when calculating caret slope
- Date: Mon, 20 Jun 2022 16:28:46 +0000 (UTC)
commit e30df90088ddbfab7d2479c5972f587ba4c1c4ea
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 19 07:47:10 2022 -0700
Avoid overflow when calculating caret slope
This showed up as wrong slopes with font size > 60.
pango/pango-line.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/pango/pango-line.c b/pango/pango-line.c
index 10661e90..7672a3e1 100644
--- a/pango/pango-line.c
+++ b/pango/pango-line.c
@@ -1574,7 +1574,8 @@ pango_line_get_caret_pos (PangoLine *line,
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]