From e332522a61fad2a6798cc83a789e337af85a8d54 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 10 Dec 2017 09:21:46 +0530 Subject: [PATCH] Mark backend API in fonts.h header --- kitty/core_text.m | 2 +- kitty/fonts.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kitty/core_text.m b/kitty/core_text.m index 2b4b5e49a..fed836a32 100644 --- a/kitty/core_text.m +++ b/kitty/core_text.m @@ -91,7 +91,7 @@ font_descriptor_from_python(PyObject *src) { return CTFontDescriptorCreateWithAttributes((CFDictionaryRef) attrs); } -PyObject* +static PyObject* coretext_all_fonts(PyObject UNUSED *_self) { static CTFontCollectionRef collection = NULL; if (collection == NULL) collection = CTFontCollectionCreateFromAvailableFonts(NULL); diff --git a/kitty/fonts.h b/kitty/fonts.h index cb147c8d2..3407b0cf0 100644 --- a/kitty/fonts.h +++ b/kitty/fonts.h @@ -13,12 +13,16 @@ #pragma GCC diagnostic pop +// API that font backends need to implement 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); +bool render_glyphs_in_cells(PyObject *f, bool bold, bool italic, hb_glyph_info_t *info, hb_glyph_position_t *positions, unsigned int num_glyphs, pixel *canvas, unsigned int cell_width, unsigned int cell_height, unsigned int num_cells, unsigned int baseline, bool *was_colored); +PyObject* create_fallback_face(PyObject *base_face, Cell* cell, bool bold, bool italic); +PyObject* specialize_font_descriptor(PyObject *base_descriptor); + void cell_metrics(PyObject*, unsigned int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*); void sprite_tracker_current_layout(unsigned int *x, unsigned int *y, unsigned int *z); -bool render_glyphs_in_cells(PyObject *f, bool bold, bool italic, hb_glyph_info_t *info, hb_glyph_position_t *positions, unsigned int num_glyphs, pixel *canvas, unsigned int cell_width, unsigned int cell_height, unsigned int num_cells, unsigned int baseline, bool *was_colored); void render_alpha_mask(uint8_t *alpha_mask, pixel* dest, Region *src_rect, Region *dest_rect, size_t src_stride, size_t dest_stride); void render_line(Line *line); void sprite_tracker_set_limits(size_t max_texture_size, size_t max_array_len); @@ -26,8 +30,6 @@ void sprite_tracker_set_layout(unsigned int cell_width, unsigned int cell_height typedef void (*free_extra_data_func)(void*); PyObject* ft_face_from_data(const uint8_t* data, size_t sz, void *extra_data, free_extra_data_func fed, PyObject *path, int hinting, int hintstyle, float); PyObject* ft_face_from_path_and_psname(PyObject* path, const char* psname, void *extra_data, free_extra_data_func fed, int hinting, int hintstyle, float); -PyObject* specialize_font_descriptor(PyObject *base_descriptor); -PyObject* create_fallback_face(PyObject *base_face, Cell* cell, bool bold, bool italic); PyObject* face_from_descriptor(PyObject*); PyObject* face_from_path(const char *path, int index); #ifdef __APPLE__