mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-14 20:44:32 +02:00
Font fallback: Fix the font used to render a character sometimes dependent on the order in which characters appear on screen
We ameliorate the performance hit by storing a hash table mapping cell text to the loaded fallback font index so that lookups for previously seen text are still fast. Fixes #6865
This commit is contained in:
@@ -218,6 +218,17 @@ set_load_error(const char *path, int error) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
face_equals_descriptor(PyObject *face_, PyObject *descriptor) {
|
||||
Face *face = (Face*)face_;
|
||||
PyObject *t = PyDict_GetItemString(descriptor, "path");
|
||||
if (!t) return false;
|
||||
if (PyObject_RichCompareBool(face->path, t, Py_EQ) != 1) return false;
|
||||
t = PyDict_GetItemString(descriptor, "index");
|
||||
if (t && PyLong_AsLong(t) != face->index) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
PyObject*
|
||||
face_from_descriptor(PyObject *descriptor, FONTS_DATA_HANDLE fg) {
|
||||
#define D(key, conv, missing_ok) { \
|
||||
@@ -285,7 +296,6 @@ repr(Face *self) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
postscript_name_for_face(const PyObject *face_) {
|
||||
const Face *self = (const Face*)face_;
|
||||
@@ -723,7 +733,6 @@ static PyMethodDef methods[] = {
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
PyTypeObject Face_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "fast_data_types.Face",
|
||||
|
||||
Reference in New Issue
Block a user