Linux: Dont fail on systems with fonts that have non-UTF-8 names. Fixes #1281

This commit is contained in:
Kovid Goyal 2018-12-31 07:31:17 +05:30
parent 89be7a031d
commit 4273cb35bf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -24,11 +24,12 @@ pyspacing(int val) {
#undef S
}
static inline PyObject*
pattern_as_dict(FcPattern *pat) {
PyObject *ans = PyDict_New();
if (ans == NULL) return NULL;
#define PS(x) PyUnicode_FromString((char*)x)
#define PS(x) PyUnicode_Decode((const char*)x, strlen((const char*)x), "UTF-8", "replace")
#define G(type, get, which, conv, name) { \
type out; PyObject *p; \
if (get(pat, which, 0, &out) == FcResultMatch) { \