mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
render: fix double-width glyphs glitching when surrounding cells overflow into it
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
This commit is contained in:
parent
d1220aebfd
commit
a9298959a1
2 changed files with 13 additions and 6 deletions
|
|
@ -121,6 +121,8 @@
|
|||
* URL underlines sometimes still being visible after exiting URL mode.
|
||||
* Text-bindings, and pipe-* bindings, with multiple key mappings
|
||||
causing a crash (double-free) on exit ([#1259][1259]).
|
||||
* Double-width glyphs glitching when surrounded by glyphs overflowing
|
||||
into the double-width glyph ([#1256][1256]).
|
||||
|
||||
[1173]: https://codeberg.org/dnkl/foot/issues/1173
|
||||
[1190]: https://codeberg.org/dnkl/foot/issues/1190
|
||||
|
|
@ -128,6 +130,7 @@
|
|||
[1209]: https://codeberg.org/dnkl/foot/issues/1209
|
||||
[1218]: https://codeberg.org/dnkl/foot/issues/1218
|
||||
[1259]: https://codeberg.org/dnkl/foot/issues/1259
|
||||
[1256]: https://codeberg.org/dnkl/foot/issues/1256
|
||||
|
||||
|
||||
### Security
|
||||
|
|
|
|||
16
render.c
16
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue