diff --git a/kitty/fonts.c b/kitty/fonts.c index 6940a738a..90687ea1b 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -248,6 +248,11 @@ set_font_size(PyObject UNUSED *m, PyObject *args) { return update_cell_metrics(); } +static inline bool +face_has_codepoint(PyObject* face, char_type cp) { + return glyph_id_for_codepoint(face, cp) > 0; +} + static inline bool has_cell_text(Font *self, Cell *cell) { if (!face_has_codepoint(self->face, cell->ch)) return false; diff --git a/kitty/fonts.h b/kitty/fonts.h index 84b1e01c4..033b1b75d 100644 --- a/kitty/fonts.h +++ b/kitty/fonts.h @@ -14,7 +14,7 @@ -bool face_has_codepoint(PyObject *, char_type); +unsigned int glyph_id_for_codepoint(PyObject *, char_type); hb_font_t* harfbuzz_font_for_face(PyObject*); bool set_size_for_face(PyObject*, unsigned int, bool); void cell_metrics(PyObject*, unsigned int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*); diff --git a/kitty/freetype.c b/kitty/freetype.c index 48b9fde45..0d7f14777 100644 --- a/kitty/freetype.c +++ b/kitty/freetype.c @@ -301,9 +301,9 @@ cell_metrics(PyObject *s, unsigned int* cell_width, unsigned int* cell_height, u *underline_thickness = MAX(1, font_units_to_pixels(self, self->underline_thickness)); } -bool -face_has_codepoint(PyObject *s, char_type cp) { - return FT_Get_Char_Index(((Face*)s)->face, cp) > 0; +unsigned int +glyph_id_for_codepoint(PyObject *s, char_type cp) { + return FT_Get_Char_Index(((Face*)s)->face, cp); } hb_font_t*