emacs-diffs
[Top][All Lists]
Advanced

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

master 33e2418: Fix scrolling problems with misc-fixed fonts under Cairo


From: Eli Zaretskii
Subject: master 33e2418: Fix scrolling problems with misc-fixed fonts under Cairo
Date: Sat, 7 Nov 2020 03:28:07 -0500 (EST)

branch: master
commit 33e2418a7cfd2ac1b98b86c5ddaf99c1d90daaf0
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix scrolling problems with misc-fixed fonts under Cairo
    
    * src/ftcrfont.c (ftcrfont_glyph_extents): Avoid rounding up the
    glyph ascent to a higher value than needed due to floating-point
    roundoff errors.  (Bug#44284)
---
 src/ftcrfont.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index a10308c..b895107 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -84,7 +84,12 @@ ftcrfont_glyph_extents (struct font *font,
       cache->lbearing = floor (extents.x_bearing);
       cache->rbearing = ceil (extents.width + extents.x_bearing);
       cache->width = lround (extents.x_advance);
-      cache->ascent = ceil (- extents.y_bearing);
+      /* The subtraction of a small number is to avoid rounding up due
+        to floating-point inaccuracies with some fonts, which then
+        could cause unpleasant effects while scrolling (see bug
+        #44284), since we then think that a glyph row's ascent is too
+        small to accommodate a glyph with a higher phys_ascent.  */
+      cache->ascent = ceil (- extents.y_bearing - 1.0 / 256);
       cache->descent = ceil (extents.height + extents.y_bearing);
     }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]