Linux: Fix incorrect scaling for fallback fonts when the font has an underscore that renders out of bounds

The calc_cell_height() function should not use underscore heights when
called in contexts other than cell metrics calculation.

Fixes #1713
This commit is contained in:
Kovid Goyal 2019-06-30 08:51:35 +05:30
parent 0be6c9cb97
commit cde69670ba
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 4 deletions

View File

@ -29,6 +29,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- macOS: Reduce energy consumption when idle by shutting down Apple's display
link thread after 30 second of inactivity (:iss:`1763`)
- Linux: Fix incorrect scaling for fallback fonts when the font has an
underscore that renders out of bounds (:iss:`1713`)
0.14.2 [2019-06-09]
---------------------

View File

@ -123,11 +123,15 @@ get_height_for_char(Face *self, char ch) {
static inline unsigned int
calc_cell_height(Face *self, bool for_metrics) {
unsigned int ans = font_units_to_pixels_y(self, self->height);
unsigned int underscore_height = get_height_for_char(self, '_');
if (for_metrics && global_state.debug_font_fallback && underscore_height > ans) {
printf("Increasing cell height by %u pixels to work around buggy font that renders underscore outside the bounding box\n", underscore_height - ans);
if (for_metrics) {
unsigned int underscore_height = get_height_for_char(self, '_');
if (underscore_height > ans) {
if (global_state.debug_font_fallback) printf(
"Increasing cell height by %u pixels to work around buggy font that renders underscore outside the bounding box\n", underscore_height - ans);
return underscore_height;
}
}
return MAX(ans, underscore_height);
return ans;
}
static inline bool