Also make the postscript name available
This commit is contained in:
parent
e34f74fb7a
commit
3760d3d719
2 changed files with 11 additions and 7 deletions
|
|
@ -20,7 +20,7 @@
|
|||
unsigned int units_per_em;
|
||||
float ascent, descent, leading, underline_position, underline_thickness, point_sz, scaled_point_sz;
|
||||
CTFontRef font;
|
||||
PyObject *family_name, *full_name;
|
||||
PyObject *family_name, *full_name, *postscript_name;
|
||||
} Face;
|
||||
|
||||
|
||||
|
|
@ -62,10 +62,11 @@
|
|||
self->leading = CTFontGetLeading(self->font);
|
||||
self->underline_position = CTFontGetUnderlinePosition(self->font);
|
||||
self->underline_thickness = CTFontGetUnderlineThickness(self->font);
|
||||
self->scaled_point_sz = CTFontGetSize(self->font);
|
||||
self->family_name = convert_cfstring(CTFontCopyFamilyName(self->font));
|
||||
self->full_name = convert_cfstring(CTFontCopyFullName(self->font));
|
||||
self->scaled_point_sz = CTFontGetSize(self->font);
|
||||
if (self->family_name == NULL || self->full_name == NULL) { Py_CLEAR(self); }
|
||||
self->postscript_name = convert_cfstring(CTFontCopyPostScriptName(self->font));
|
||||
if (self->family_name == NULL || self->full_name == NULL || self->postscript_name == NULL) { Py_CLEAR(self); }
|
||||
}
|
||||
} else {
|
||||
Py_CLEAR(self);
|
||||
|
|
@ -80,7 +81,7 @@
|
|||
static void
|
||||
dealloc(Face* self) {
|
||||
if (self->font) CFRelease(self->font);
|
||||
Py_CLEAR(self->family_name); Py_CLEAR(self->full_name);
|
||||
Py_CLEAR(self->family_name); Py_CLEAR(self->full_name); Py_CLEAR(self->postscript_name);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
|
|
@ -200,6 +201,7 @@
|
|||
MEM(underline_thickness, T_FLOAT),
|
||||
MEM(family_name, T_OBJECT),
|
||||
MEM(full_name, T_OBJECT),
|
||||
MEM(postscript_name, T_OBJECT),
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -64,17 +64,19 @@ def render_cell(text=' ', bold=False, italic=False):
|
|||
return first, second
|
||||
|
||||
|
||||
def develop(sz=288):
|
||||
def develop(family='monospace', sz=288):
|
||||
import pickle
|
||||
from .render import render_string
|
||||
from kitty.fast_data_types import glfw_init
|
||||
import os
|
||||
glfw_init()
|
||||
try:
|
||||
os.remove('/tmp/cell.data')
|
||||
except EnvironmentError:
|
||||
pass
|
||||
set_font_family('monospace', sz, ignore_dpi_failure=True)
|
||||
set_font_family(family, sz, ignore_dpi_failure=True)
|
||||
for (bold, italic), face in main_font.items():
|
||||
print('bold: {} italic: {} family:{} full name: {}'.format(bold, italic, face.family_name, face.full_name))
|
||||
print('bold: {} italic: {} family:{} full name: {} postscript_name: {}'.format(bold, italic, face.family_name, face.full_name, face.postscript_name))
|
||||
f = main_font[(False, False)]
|
||||
for attr in 'units_per_em ascent descent leading underline_position underline_thickness scaled_point_sz'.split():
|
||||
print(attr, getattr(f, attr))
|
||||
|
|
|
|||
Loading…
Reference in a new issue