From 779a49acde85153ac027320d1e4b9dfd0a33a908 Mon Sep 17 00:00:00 2001 From: Strykar <2946372+Strykar@users.noreply.github.com> Date: Wed, 10 Jun 2026 13:57:30 +0530 Subject: [PATCH] fonts: preserve the font matrix when specializing a descriptor specialize_font_descriptor() re-resolves a descriptor by file, index, size and dpi to pick up size dependent fields. The re-match carries no slant request, so fontconfig cannot re-derive a synthetic italic matrix, and only index, named_style and axes were copied back from the base descriptor. Any FC_MATRIX on the descriptor was therefore lost on every sized face build, so the face was constructed without it and FT_Set_Transform was never called, rendering the glyphs upright. Descriptors can carry FC_MATRIX since b3e7c3e ("Read FC_MATRIX from fontconfig"). Copy the matrix back like the other selection derived fields the re-match cannot reproduce. --- kitty/fontconfig.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kitty/fontconfig.c b/kitty/fontconfig.c index 388ccf8b1..a7847468e 100644 --- a/kitty/fontconfig.c +++ b/kitty/fontconfig.c @@ -458,6 +458,10 @@ specialize_font_descriptor(PyObject *base_descriptor, double font_sz_in_pts, dou if (axes) { if (PyDict_SetItemString(ans, "axes", axes) != 0) return NULL; } + PyObject *matrix = PyDict_GetItemString(base_descriptor, "matrix"); + if (matrix) { + if (PyDict_SetItemString(ans, "matrix", matrix) != 0) return NULL; + } PyObject *ff = PyDict_GetItemString(ans, "fontfeatures"); if (ff && PyList_GET_SIZE(ff)) { for (Py_ssize_t i = 0; i < PyList_GET_SIZE(ff); i++) {