Fix rendering of combining characters with fonts that have glyphs for precomposed characters but not decomposed versions

Fix #2365
This commit is contained in:
Kovid Goyal 2020-02-15 21:55:17 +05:30
parent 64567646d9
commit 734c3199f0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 17 additions and 3 deletions

View File

@ -33,6 +33,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- macOS: Fix menubar title not updating on OS Window focus change (:iss:`2350`)
- Fix rendering of combining characters with fonts that have glyphs for
precomposed characters but not decomposed versions (:iss:`2365`)
0.16.0 [2020-01-28]
--------------------

View File

@ -474,10 +474,21 @@ has_emoji_presentation(CPUCell *cpu_cell, GPUCell *gpu_cell) {
static inline bool
has_cell_text(Font *self, CPUCell *cell) {
if (!face_has_codepoint(self->face, cell->ch)) return false;
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++) {
combining_type cc_idx = cell->cc_idx[i];
if (cc_idx == VS15 || cc_idx == VS16) continue;
if (!face_has_codepoint(self->face, codepoint_for_mark(cc_idx))) return false;
if (cell->cc_idx[i] == VS15 || cell->cc_idx[i] == VS16) continue;
combining_chars[num_cc++] = codepoint_for_mark(cell->cc_idx[i]);
}
if (num_cc == 0) return true;
if (num_cc == 1) {
if (face_has_codepoint(self->face, combining_chars[0])) return true;
char_type ch = 0;
if (hb_unicode_compose(hb_unicode_funcs_get_default(), ch, combining_chars[0], &ch) && face_has_codepoint(self->face, ch)) return true;
return false;
}
for (unsigned i = 0; i < num_cc; i++) {
if (!face_has_codepoint(self->face, combining_chars[i])) return false;
}
return true;
}