From 574386f45b3dc602c0d5801e57684e92b5a98996 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 Sep 2025 20:44:35 +0530 Subject: [PATCH] Fix rendering of underlines when using larger text sizes with the space and en-space characters Fixes #8950 --- docs/changelog.rst | 3 +++ kitty/fonts.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index c3dfbd716..973aed73d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -162,6 +162,9 @@ Detailed list of changes - Fix a regression in 0.40.0 that broke handling of the VS16 variation selector when it caused a character to flow to the next line (:iss:`8848`) +- Fix rendering of underlines when using larger text sizes with the space and + en-space characters (:iss:`8950`) + - Wayland: Update bundled copy of libwayland to 1.24 from 1.23.1 because the just released mesa 25.2.0 breaks with libwayland < 1.24 (:iss:`8884`) diff --git a/kitty/fonts.c b/kitty/fonts.c index d580bd23b..e95408c66 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -744,7 +744,10 @@ START_ALLOW_CASE_RANGE if (allow_use_of_box_fonts) return BOX_FONT; /* fallthrough */ default: - if (lc->count == 1 && (lc->chars[0] == ' ' || lc->chars[0] == 0x2002 /* en-space */)) return BLANK_FONT; + // Optimisation to avoid rendering spaces, except in the case of + // scaled multicells as the decorations there have to rendered + // scaled as well. + if (lc->count == 1 && (lc->chars[0] == ' ' || lc->chars[0] == 0x2002 /* en-space */) && (!cpu_cell->is_multicell || cpu_cell->scale == 1)) return BLANK_FONT; *is_emoji_presentation = has_emoji_presentation(cpu_cell, lc); ans = in_symbol_maps(fg, lc->chars[0]); if (ans > -1) return ans; @@ -1781,7 +1784,9 @@ render_run(FontGroup *fg, CPUCell *first_cpu_cell, GPUCell *first_gpu_cell, inde render_groups(fg, rf, center_glyph, tc); break; case BLANK_FONT: - while(num_cells--) { first_gpu_cell->sprite_idx = 0; first_cpu_cell++; first_gpu_cell++; } + while (num_cells--) { + first_gpu_cell->sprite_idx = 0; first_cpu_cell++; first_gpu_cell++; + } break; case BOX_FONT: while(num_cells) {