From a9298959a188013530257a665d839a6343229b85 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 15 Jan 2023 14:42:48 +0100 Subject: render: fix double-width glyphs glitching when surrounding cells overflow into it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If cells overflowed (for example, by using an italic font that isn’t truly monospaced) into a double-width glyph (that itself is *not* overflowing), then the double-width glyph would glitch when being rendered; typically the second half of it would occasionally disappear. This happened because we tried to rasterize the second cell of the double-width glyph. This cell contains a special “spacer” value. Rasterizing that typically results the font’s “not available” glyph. If _that_ glyph overflows, things broke; we’d later end up forcing a re-render of it (thus erasing half the double-width glyph). But since the double-width glyph _itself_ doesn’t overflow, _it_ wouldn’t be re-rendered, leaving it half erased. Fix by recognizing spacer cells, and not trying to rasterize them (set glyph count to 0, and cell count to 1). Closes #1256 --- render.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index f5e7f627..92a37d7c 100644 --- a/render.c +++ b/render.c @@ -646,17 +646,21 @@ render_cell(struct terminal *term, pixman_image_t *pix, } } - if (single == NULL && grapheme == NULL) { - xassert(base != 0); - single = fcft_rasterize_char_utf32(font, base, term->font_subpixel); - if (single == NULL) { + if (unlikely(base >= CELL_SPACER)) { glyph_count = 0; cell_cols = 1; } else { - glyph_count = 1; - glyphs = &single; + xassert(base != 0); + single = fcft_rasterize_char_utf32(font, base, term->font_subpixel); + if (single == NULL) { + glyph_count = 0; + cell_cols = 1; + } else { + glyph_count = 1; + glyphs = &single; cell_cols = single->cols; + } } } } -- cgit v1.3