mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 17:27:39 +02:00
Revert "Workaround for fontconfig returning junk in all but the lowest eight bits for FC_INDEX"
This reverts commit d2c21ee297.
Apparently fontconfig overloads the top 16 bits as "instance index"
which is some kind of index for variable fonts? Who knows. fontconfig is
a natural disaster.
Fixes #7361
This commit is contained in:
@@ -147,8 +147,6 @@ pyspacing(int val) {
|
|||||||
#undef S
|
#undef S
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
|
||||||
pyindex(long x) { return PyLong_FromLong(x & 0xffff); }
|
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
pattern_as_dict(FcPattern *pat) {
|
pattern_as_dict(FcPattern *pat) {
|
||||||
@@ -192,7 +190,7 @@ pattern_as_dict(FcPattern *pat) {
|
|||||||
I(FC_WIDTH, width)
|
I(FC_WIDTH, width)
|
||||||
I(FC_SLANT, slant);
|
I(FC_SLANT, slant);
|
||||||
I(FC_HINT_STYLE, hint_style);
|
I(FC_HINT_STYLE, hint_style);
|
||||||
G(int, FcPatternGetInteger, FC_INDEX, pyindex, index);
|
I(FC_INDEX, index);
|
||||||
I(FC_RGBA, subpixel);
|
I(FC_RGBA, subpixel);
|
||||||
I(FC_LCD_FILTER, lcdfilter);
|
I(FC_LCD_FILTER, lcdfilter);
|
||||||
B(FC_HINTING, hinting);
|
B(FC_HINTING, hinting);
|
||||||
@@ -313,7 +311,6 @@ _native_fc_match(FcPattern *pat, FontConfigFace *ans) {
|
|||||||
#undef g
|
#undef g
|
||||||
ans->path = strdup((char*)out);
|
ans->path = strdup((char*)out);
|
||||||
if (!ans->path) { PyErr_NoMemory(); goto end; }
|
if (!ans->path) { PyErr_NoMemory(); goto end; }
|
||||||
ans->index &= 0xffff;
|
|
||||||
ok = true;
|
ok = true;
|
||||||
end:
|
end:
|
||||||
if (match != NULL) FcPatternDestroy(match);
|
if (match != NULL) FcPatternDestroy(match);
|
||||||
@@ -406,7 +403,7 @@ specialize_font_descriptor(PyObject *base_descriptor, FONTS_DATA_HANDLE fg) {
|
|||||||
if (pat == NULL) return PyErr_NoMemory();
|
if (pat == NULL) return PyErr_NoMemory();
|
||||||
long face_idx = MAX(0, PyLong_AsLong(idx));
|
long face_idx = MAX(0, PyLong_AsLong(idx));
|
||||||
AP(FcPatternAddString, FC_FILE, (const FcChar8*)PyUnicode_AsUTF8(p), "path");
|
AP(FcPatternAddString, FC_FILE, (const FcChar8*)PyUnicode_AsUTF8(p), "path");
|
||||||
AP(FcPatternAddInteger, FC_INDEX, face_idx & 0xffff, "index");
|
AP(FcPatternAddInteger, FC_INDEX, face_idx, "index");
|
||||||
AP(FcPatternAddDouble, FC_SIZE, fg->font_sz_in_pts, "size");
|
AP(FcPatternAddDouble, FC_SIZE, fg->font_sz_in_pts, "size");
|
||||||
AP(FcPatternAddDouble, FC_DPI, (fg->logical_dpi_x + fg->logical_dpi_y) / 2.0, "dpi");
|
AP(FcPatternAddDouble, FC_DPI, (fg->logical_dpi_x + fg->logical_dpi_y) / 2.0, "dpi");
|
||||||
ans = _fc_match(pat);
|
ans = _fc_match(pat);
|
||||||
|
|||||||
Reference in New Issue
Block a user