A more general cp->gid API

This commit is contained in:
Kovid Goyal 2017-11-12 23:40:20 +05:30
parent d01e5f72fc
commit 336857a106
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 9 additions and 4 deletions

View File

@ -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;

View File

@ -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*);

View File

@ -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*