diff options
| author | Eli Zaretskii | 2020-11-07 10:27:15 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2020-11-07 10:27:15 +0200 |
| commit | 33e2418a7cfd2ac1b98b86c5ddaf99c1d90daaf0 (patch) | |
| tree | ad299ea59b416e960052af067807240fc8cb406f /src | |
| parent | ece1e1da5ea86fb02230e10111ea188ee0a59fc9 (diff) | |
| download | emacs-33e2418a7cfd2ac1b98b86c5ddaf99c1d90daaf0.tar.gz emacs-33e2418a7cfd2ac1b98b86c5ddaf99c1d90daaf0.zip | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ftcrfont.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ftcrfont.c b/src/ftcrfont.c index a10308c62ee..b89510704e1 100644 --- a/src/ftcrfont.c +++ b/src/ftcrfont.c | |||
| @@ -84,7 +84,12 @@ ftcrfont_glyph_extents (struct font *font, | |||
| 84 | cache->lbearing = floor (extents.x_bearing); | 84 | cache->lbearing = floor (extents.x_bearing); |
| 85 | cache->rbearing = ceil (extents.width + extents.x_bearing); | 85 | cache->rbearing = ceil (extents.width + extents.x_bearing); |
| 86 | cache->width = lround (extents.x_advance); | 86 | cache->width = lround (extents.x_advance); |
| 87 | cache->ascent = ceil (- extents.y_bearing); | 87 | /* The subtraction of a small number is to avoid rounding up due |
| 88 | to floating-point inaccuracies with some fonts, which then | ||
| 89 | could cause unpleasant effects while scrolling (see bug | ||
| 90 | #44284), since we then think that a glyph row's ascent is too | ||
| 91 | small to accommodate a glyph with a higher phys_ascent. */ | ||
| 92 | cache->ascent = ceil (- extents.y_bearing - 1.0 / 256); | ||
| 88 | cache->descent = ceil (extents.height + extents.y_bearing); | 93 | cache->descent = ceil (extents.height + extents.y_bearing); |
| 89 | } | 94 | } |
| 90 | 95 | ||