diff --git a/src_c/font.c b/src_c/font.c index 9afe2741c0..96bc4ac8b0 100644 --- a/src_c/font.c +++ b/src_c/font.c @@ -475,7 +475,7 @@ font_set_strikethrough(PyObject *self, PyObject *arg) } static PyObject * -font_render(PyObject *self, PyObject *args) +font_render(PyObject *self, PyObject *args, PyObject *kwarg) { TTF_Font *font = PyFont_AsFont(self); int antialias; @@ -485,9 +485,12 @@ font_render(PyObject *self, PyObject *args) SDL_Surface *surf; const char *astring = ""; int wraplength = 0; + char *kwds[] = {"text", "antialias", "color", + "background", "wraplength", NULL}; - if (!PyArg_ParseTuple(args, "OpO|Oi", &text, &antialias, &fg_rgba_obj, - &bg_rgba_obj, &wraplength)) { + if (!PyArg_ParseTupleAndKeywords(args, kwarg, "OpO|Oi", kwds, &text, + &antialias, &fg_rgba_obj, &bg_rgba_obj, + &wraplength)) { return NULL; } @@ -871,7 +874,8 @@ static PyMethodDef font_methods[] = { {"set_strikethrough", font_set_strikethrough, METH_O, DOC_FONT_FONT_SETSTRIKETHROUGH}, {"metrics", font_metrics, METH_O, DOC_FONT_FONT_METRICS}, - {"render", font_render, METH_VARARGS, DOC_FONT_FONT_RENDER}, + {"render", font_render, METH_VARARGS | METH_KEYWORDS, + DOC_FONT_FONT_RENDER}, {"size", font_size, METH_O, DOC_FONT_FONT_SIZE}, {"set_script", font_set_script, METH_O, DOC_FONT_FONT_SETSCRIPT}, {"set_direction", (PyCFunction)font_set_direction,