Output font features in debug info

This commit is contained in:
Kovid Goyal
2024-08-25 11:19:36 +05:30
parent 0d57253300
commit ab3cefd81f
3 changed files with 20 additions and 4 deletions

View File

@@ -747,7 +747,14 @@ identify_for_debug(PyObject *s, PyObject *a UNUSED) {
Face *self = (Face*)s;
FaceIndex instance;
instance.val = self->face->face_index;
return PyUnicode_FromFormat("%s: %V:%d", FT_Get_Postscript_Name(self->face), self->path, "[path]", instance.val);
RAII_PyObject(features, PyTuple_New(self->font_features.count)); if (!features) return NULL;
char buf[128];
for (unsigned i = 0; i < self->font_features.count; i++) {
hb_feature_to_string(self->font_features.features + i, buf, sizeof(buf));
PyObject *f = PyUnicode_FromString(buf); if (!f) return NULL;
PyTuple_SET_ITEM(features, i, f);
}
return PyUnicode_FromFormat("%s: %V:%d\nFeatures: %S", FT_Get_Postscript_Name(self->face), self->path, "[path]", instance.val, features);
}
static PyObject*