From e8b19e08fa5f035b7407b41b1fbc7ccc1b700234 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 Jan 2022 22:33:53 +0530 Subject: [PATCH] Fix non-renderable combining chars causing some text to not be rendered on Linux The test for non-renderable chars was broken and the variation selectors were not included in the test. Fixes #4444 --- docs/changelog.rst | 3 +++ gen-wcwidth.py | 2 +- kitty/fonts.c | 3 ++- kitty/unicode-data.c | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index d6579531e..e2c36b662 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -86,6 +86,9 @@ Detailed list of changes - Fix showing debug information not working if kitty's :file:`STDIN` is not a tty (:iss:`4424`) +- Linux: Fix a regression that broke rendering of emoji with variation selectors + (:iss:`4444`) + 0.24.0 [2022-01-04] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/gen-wcwidth.py b/gen-wcwidth.py index aeeab712c..09f4b9a66 100755 --- a/gen-wcwidth.py +++ b/gen-wcwidth.py @@ -388,7 +388,7 @@ def gen_ucd() -> None: category_test( 'is_non_rendered_char', p, 'Cc Cs Cf'.split(), 'Other_Default_Ignorable_Code_Point and soft hyphen', - extra_chars=property_maps['Other_Default_Ignorable_Code_Point'], + extra_chars=property_maps['Other_Default_Ignorable_Code_Point'] | set(range(0xfe00, 0xfe0f + 1)), ascii_range='false' ) category_test('is_word_char', p, {c for c in class_maps if c[0] in 'LN'}, 'L and N categories') diff --git a/kitty/fonts.c b/kitty/fonts.c index c6b0f1328..49c903fe7 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -387,7 +387,8 @@ has_cell_text(Font *self, CPUCell *cell) { char_type combining_chars[arraysz(cell->cc_idx)]; unsigned num_cc = 0; for (unsigned i = 0; i < arraysz(cell->cc_idx) && cell->cc_idx[i]; i++) { - if (!is_non_rendered_char(cell->cc_idx[i])) combining_chars[num_cc++] = codepoint_for_mark(cell->cc_idx[i]); + const char_type ccp = codepoint_for_mark(cell->cc_idx[i]); + if (!is_non_rendered_char(ccp)) combining_chars[num_cc++] = ccp; } if (num_cc == 0) return true; if (num_cc == 1) { diff --git a/kitty/unicode-data.c b/kitty/unicode-data.c index 1e6b41dc9..16b1fd7a9 100644 --- a/kitty/unicode-data.c +++ b/kitty/unicode-data.c @@ -699,7 +699,7 @@ is_ignored_char(char_type code) { bool is_non_rendered_char(char_type code) { - // Other_Default_Ignorable_Code_Point and soft hyphen (6052 codepoints) {{{ + // Other_Default_Ignorable_Code_Point and soft hyphen (6068 codepoints) {{{ if (LIKELY(0x20 <= code && code <= 0x7e)) return false; switch(code) { case 0x0 ... 0x1f: @@ -738,6 +738,8 @@ is_non_rendered_char(char_type code) { return true; case 0xd800 ... 0xdfff: return true; + case 0xfe00 ... 0xfe0f: + return true; case 0xfeff: return true; case 0xffa0: