mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 08:47:47 +02:00
Output font features in debug info
This commit is contained in:
@@ -1070,10 +1070,16 @@ get_variable_data(CTFace *self) {
|
|||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
identify_for_debug(CTFace *self) {
|
identify_for_debug(CTFace *self) {
|
||||||
return PyUnicode_FromFormat("%V: %V", self->postscript_name, "[psname]", self->path, "[path]");
|
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("%V: %V\nFeatures: %S", self->postscript_name, "[psname]", self->path, "[path]", features);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,10 @@ def debug_config(opts: KittyOpts) -> str:
|
|||||||
p(green('Fonts:'))
|
p(green('Fonts:'))
|
||||||
for k, font in current_fonts().items():
|
for k, font in current_fonts().items():
|
||||||
if hasattr(font, 'identify_for_debug'):
|
if hasattr(font, 'identify_for_debug'):
|
||||||
p(yellow(f' {k}:'), font.identify_for_debug())
|
flines = font.identify_for_debug().splitlines()
|
||||||
|
p(yellow(f'{k.rjust(8)}:'), flines[0])
|
||||||
|
for fl in flines[1:]:
|
||||||
|
p(' ' * 9, fl)
|
||||||
p(green('Paths:'))
|
p(green('Paths:'))
|
||||||
p(yellow(' kitty:'), os.path.realpath(kitty_exe()))
|
p(yellow(' kitty:'), os.path.realpath(kitty_exe()))
|
||||||
p(yellow(' base dir:'), kitty_base_dir)
|
p(yellow(' base dir:'), kitty_base_dir)
|
||||||
|
|||||||
@@ -747,7 +747,14 @@ identify_for_debug(PyObject *s, PyObject *a UNUSED) {
|
|||||||
Face *self = (Face*)s;
|
Face *self = (Face*)s;
|
||||||
FaceIndex instance;
|
FaceIndex instance;
|
||||||
instance.val = self->face->face_index;
|
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*
|
static PyObject*
|
||||||
|
|||||||
Reference in New Issue
Block a user