diff --git a/kitty/fonts.c b/kitty/fonts.c index 0d26718a0..ec8c91f4a 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -392,7 +392,8 @@ calc_cell_metrics(FontGroup *fg) { underline_position = MIN(cell_height - 1, underline_position); // ensure there is at least a couple of pixels available to render styled underlines - while (underline_position > baseline + 1 && cell_height - underline_position < 2) underline_position--; + // there should be at least one pixel on either side of the underline_position + while (underline_position > baseline + 1 && cell_height - underline_position < 1) underline_position--; if (line_height_adjustment > 1) { baseline += MIN(cell_height - 1, (unsigned)line_height_adjustment / 2); underline_position += MIN(cell_height - 1, (unsigned)line_height_adjustment / 2);