@@ -226,6 +226,29 @@ font_get_linesize(PyObject *self, PyObject *_null)
226226#endif
227227}
228228
229+ static PyObject *
230+ font_set_linesize (PyObject * self , PyObject * arg )
231+ {
232+ if (!PgFont_GenerationCheck (self )) {
233+ return RAISE_FONT_QUIT_ERROR ();
234+ }
235+
236+ #if SDL_TTF_VERSION_ATLEAST (2 , 24 , 0 )
237+ TTF_Font * font = PyFont_AsFont (self );
238+ int linesize = PyLong_AsLong (arg );
239+ if (linesize < 0 || PyErr_Occurred ()) {
240+ return RAISE (PyExc_ValueError , "linesize must be >= 0" );
241+ }
242+ TTF_SetFontLineSkip (font , linesize );
243+
244+ Py_RETURN_NONE ;
245+ #else
246+ return RAISE (
247+ PyExc_NotImplementedError ,
248+ "TTF_SetFontLineSkip is not available in this version of SDL_ttf" );
249+ #endif
250+ }
251+
229252static PyObject *
230253_font_get_style_flag_as_py_bool (PyObject * self , int flag )
231254{
@@ -1155,6 +1178,7 @@ static PyMethodDef font_methods[] = {
11551178 {"get_ascent" , font_get_ascent , METH_NOARGS , DOC_FONT_FONT_GETASCENT },
11561179 {"get_linesize" , font_get_linesize , METH_NOARGS ,
11571180 DOC_FONT_FONT_GETLINESIZE },
1181+ {"set_linesize" , font_set_linesize , METH_O , DOC_FONT_FONT_SETLINESIZE },
11581182 {"get_bold" , font_get_bold , METH_NOARGS , DOC_FONT_FONT_GETBOLD },
11591183 {"set_bold" , font_set_bold , METH_O , DOC_FONT_FONT_SETBOLD },
11601184 {"get_italic" , font_get_italic , METH_NOARGS , DOC_FONT_FONT_GETITALIC },
0 commit comments