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:
parent
0be6c9cb97
commit
cde69670ba
@ -29,6 +29,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
- macOS: Reduce energy consumption when idle by shutting down Apple's display
|
- macOS: Reduce energy consumption when idle by shutting down Apple's display
|
||||||
link thread after 30 second of inactivity (:iss:`1763`)
|
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]
|
0.14.2 [2019-06-09]
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|||||||
@ -123,11 +123,15 @@ get_height_for_char(Face *self, char ch) {
|
|||||||
static inline unsigned int
|
static inline unsigned int
|
||||||
calc_cell_height(Face *self, bool for_metrics) {
|
calc_cell_height(Face *self, bool for_metrics) {
|
||||||
unsigned int ans = font_units_to_pixels_y(self, self->height);
|
unsigned int ans = font_units_to_pixels_y(self, self->height);
|
||||||
unsigned int underscore_height = get_height_for_char(self, '_');
|
if (for_metrics) {
|
||||||
if (for_metrics && global_state.debug_font_fallback && underscore_height > ans) {
|
unsigned int underscore_height = get_height_for_char(self, '_');
|
||||||
printf("Increasing cell height by %u pixels to work around buggy font that renders underscore outside the bounding box\n", underscore_height - ans);
|
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
|
static inline bool
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user