When the OS returns a fallback font that does not actually contain glyphs for the text, do not exhaust the list of fallback fonts

Fixes #1918

Apparently fontconfig does this for Tangut components.
This commit is contained in:
Kovid Goyal 2019-08-24 08:27:54 +05:30
parent a5d6cd169e
commit 35fa91fba2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 17 additions and 0 deletions

View File

@ -33,6 +33,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Fix piping PNG images into the icat kitten not working (:iss:`1920`)
- When the OS returns a fallback font that does not actually contain glyphs
for the text, do not exhaust the list of fallback fonts (:iss:`1918`)
0.14.3 [2019-07-29]
---------------------

View File

@ -497,6 +497,20 @@ load_fallback_font(FontGroup *fg, CPUCell *cell, bool bold, bool italic, bool em
Font *af = &fg->fonts[ans];
if (!init_font(af, face, bold, italic, emoji_presentation)) fatal("Out of memory");
Py_DECREF(face);
if (!has_cell_text(af, cell)) {
if (global_state.debug_font_fallback) {
printf("The font chosen by the OS for the text: ");
printf("U+%x ", cell->ch);
for (unsigned i = 0; i < arraysz(cell->cc_idx) && cell->cc_idx[i]; i++) {
printf("U+%x ", codepoint_for_mark(cell->cc_idx[i]));
}
printf("is ");
PyObject_Print(af->face, stdout, 0);
printf(" but it does not actually contain glyphs for that text\n");
}
del_font(af);
return MISSING_FONT;
}
fg->fallback_fonts_count++;
fg->fonts_count++;
return ans;