@@ -37,7 +37,21 @@ pattern_as_dict(FcPattern *pat) {
3737 if (PyDict_SetItemString(ans, #name, p) != 0) { Py_CLEAR(p); Py_CLEAR(ans); return NULL; } \
3838 Py_CLEAR(p); \
3939 }}
40+
41+ #define L (type , get , which , conv , name ) { \
42+ type out; PyObject *p; int n = 0; \
43+ PyObject *l = PyList_New(0); \
44+ while (get(pat, which, n, &out) == FcResultMatch) { \
45+ p = conv(out); if (p == NULL) { Py_CLEAR(l); Py_CLEAR(ans); return NULL; } \
46+ if (PyList_Append(l, p) != 0) { Py_CLEAR(p); Py_CLEAR(l); Py_CLEAR(ans); return NULL; } \
47+ Py_CLEAR(p); \
48+ n++; \
49+ } \
50+ if (PyDict_SetItemString(ans, #name, l) != 0) { Py_CLEAR(l); Py_CLEAR(ans); return NULL; } \
51+ Py_CLEAR(l); \
52+ }
4053#define S (which , key ) G(FcChar8*, FcPatternGetString, which, PS, key)
54+ #define LS (which , key ) L(FcChar8*, FcPatternGetString, which, PS, key)
4155#define I (which , key ) G(int, FcPatternGetInteger, which, PyLong_FromLong, key)
4256#define B (which , key ) G(int, FcPatternGetBool, which, pybool, key)
4357#define E (which , key , conv ) G(int, FcPatternGetInteger, which, conv, key)
@@ -46,7 +60,7 @@ pattern_as_dict(FcPattern *pat) {
4660 S (FC_STYLE , style );
4761 S (FC_FULLNAME , full_name );
4862 S (FC_POSTSCRIPT_NAME , postscript_name );
49- S (FC_FONT_FEATURES , fontfeatures );
63+ LS (FC_FONT_FEATURES , fontfeatures );
5064 I (FC_WEIGHT , weight );
5165 I (FC_WIDTH , width )
5266 I (FC_SLANT , slant );
0 commit comments