From 7ea0af6f6d9dfbe1953db4db836805545a6cc9b8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Mar 2024 17:26:18 +0530 Subject: [PATCH] Fix debug-font-fallback to report re-used faces correctly --- kitty/fonts.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kitty/fonts.c b/kitty/fonts.c index ae746b563..92bce9f08 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -452,7 +452,7 @@ has_cell_text(Font *self, CPUCell *cell) { } static void -output_cell_fallback_data(CPUCell *cell, bool bold, bool italic, bool emoji_presentation, PyObject *face, bool new_face) { +output_cell_fallback_data(CPUCell *cell, bool bold, bool italic, bool emoji_presentation, PyObject *face) { 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])); @@ -460,8 +460,8 @@ output_cell_fallback_data(CPUCell *cell, bool bold, bool italic, bool emoji_pres if (bold) printf("bold "); if (italic) printf("italic "); if (emoji_presentation) printf("emoji_presentation "); + if (PyLong_Check(face)) printf("using previous fallback font at index: "); PyObject_Print(face, stdout, 0); - if (new_face) printf(" (new face)"); printf("\n"); } @@ -487,7 +487,7 @@ load_fallback_font(FontGroup *fg, CPUCell *cell, bool bold, bool italic, bool em PyObject *face = create_fallback_face(fg->fonts[f].face, cell, bold, italic, emoji_presentation, (FONTS_DATA_HANDLE)fg); if (face == NULL) { PyErr_Print(); return MISSING_FONT; } if (face == Py_None) { Py_DECREF(face); return MISSING_FONT; } - if (global_state.debug_font_fallback) output_cell_fallback_data(cell, bold, italic, emoji_presentation, face, true); + if (global_state.debug_font_fallback) output_cell_fallback_data(cell, bold, italic, emoji_presentation, face); if (PyLong_Check(face)) { ssize_t ans = fg->first_fallback_font_idx + PyLong_AsSsize_t(face); Py_DECREF(face); return ans; } set_size_for_face(face, fg->cell_height, true, (FONTS_DATA_HANDLE)fg);