mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-11 14:45:31 +03:00
Output resolved fonts in debug config
This commit is contained in:
parent
3ca20ebc4e
commit
b385ccbc45
@ -808,6 +808,13 @@ static CTFontRef nerd_font(CGFloat sz) {
|
||||
size_t table_len = cftable ? CFDataGetLength(cftable) : 0;
|
||||
return read_fvar_font_table(table, table_len, self->name_lookup_table);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
identify_for_debug(CTFace *self) {
|
||||
return PyUnicode_FromFormat("%V: %V", self->postscript_name, "[psname]", self->path, "[path]");
|
||||
}
|
||||
|
||||
|
||||
// }}}
|
||||
|
||||
|
||||
@ -822,6 +829,7 @@ static CTFontRef nerd_font(CGFloat sz) {
|
||||
static PyMethodDef methods[] = {
|
||||
METHODB(display_name, METH_NOARGS),
|
||||
METHODB(get_variable_data, METH_NOARGS),
|
||||
METHODB(identify_for_debug, METH_NOARGS),
|
||||
METHODB(get_best_name, METH_O),
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
@ -17,7 +17,7 @@
|
||||
from .child import cmdline_of_pid
|
||||
from .cli import version
|
||||
from .constants import extensions_dir, is_macos, is_wayland, kitty_base_dir, kitty_exe, shell_path
|
||||
from .fast_data_types import Color, SingleKey, num_users, opengl_version_string, wayland_compositor_data
|
||||
from .fast_data_types import Color, SingleKey, current_fonts, num_users, opengl_version_string, wayland_compositor_data
|
||||
from .options.types import Options as KittyOpts
|
||||
from .options.types import defaults
|
||||
from .options.utils import KeyboardMode, KeyDefinition
|
||||
@ -257,6 +257,10 @@ def debug_config(opts: KittyOpts) -> str:
|
||||
p('Running under:', green(compositor_name()))
|
||||
p(green('OpenGL:'), opengl_version_string())
|
||||
p(green('Frozen:'), 'True' if getattr(sys, 'frozen', False) else 'False')
|
||||
p(green('Fonts:'))
|
||||
for k, font in current_fonts().items():
|
||||
if hasattr(font, 'identify_for_debug'):
|
||||
p(yellow(f' {k}:'), font.identify_for_debug())
|
||||
p(green('Paths:'))
|
||||
p(yellow(' kitty:'), os.path.realpath(kitty_exe()))
|
||||
p(yellow(' base dir:'), kitty_base_dir)
|
||||
|
@ -420,6 +420,7 @@ def fc_match_postscript_name(
|
||||
class Face:
|
||||
def __init__(self, descriptor: Optional[FontConfigPattern] = None, path: str = '', index: int = 0): ...
|
||||
def get_variable_data(self) -> VariableData: ...
|
||||
def identify_for_debug(self) -> str: ...
|
||||
|
||||
|
||||
class CoreTextFont(TypedDict):
|
||||
@ -445,6 +446,7 @@ class CoreTextFont(TypedDict):
|
||||
class CTFace:
|
||||
def __init__(self, descriptor: Optional[CoreTextFont] = None, path: str = ''): ...
|
||||
def get_variable_data(self) -> VariableData: ...
|
||||
def identify_for_debug(self) -> str: ...
|
||||
|
||||
|
||||
def coretext_all_fonts() -> Tuple[CoreTextFont, ...]:
|
||||
|
@ -691,7 +691,7 @@ render_glyphs_in_cells(PyObject *f, bool bold, bool italic, hb_glyph_info_t *inf
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
display_name(PyObject *s, PyObject *a UNUSED) {
|
||||
postscript_name(PyObject *s, PyObject *a UNUSED) {
|
||||
Face *self = (Face*)s;
|
||||
const char *psname = FT_Get_Postscript_Name(self->face);
|
||||
if (psname) return Py_BuildValue("s", psname);
|
||||
@ -699,6 +699,12 @@ display_name(PyObject *s, PyObject *a UNUSED) {
|
||||
return self->path;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
identify_for_debug(PyObject *s, PyObject *a UNUSED) {
|
||||
Face *self = (Face*)s;
|
||||
return PyUnicode_FromFormat("%s: %V:%d", FT_Get_Postscript_Name(self->face), self->path, "[path]", self->instance.val);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
extra_data(PyObject *self, PyObject *a UNUSED) {
|
||||
return PyLong_FromVoidPtr(((Face*)self)->extra_data);
|
||||
@ -862,7 +868,8 @@ static PyMemberDef members[] = {
|
||||
};
|
||||
|
||||
static PyMethodDef methods[] = {
|
||||
METHODB(display_name, METH_NOARGS),
|
||||
METHODB(postscript_name, METH_NOARGS),
|
||||
METHODB(identify_for_debug, METH_NOARGS),
|
||||
METHODB(extra_data, METH_NOARGS),
|
||||
METHODB(get_variable_data, METH_NOARGS),
|
||||
METHODB(get_best_name, METH_O),
|
||||
|
Loading…
Reference in New Issue
Block a user