@@ -815,7 +815,6 @@ font_render(FontObject *self, PyObject *args) {
815815 float y_start = 0 ;
816816 int width , height , x_offset , y_offset ;
817817 int horizontal_dir ; /* is primary axis horizontal? */
818- PyObject * max_image_pixels = Py_None ;
819818
820819 /* render string into given buffer (the buffer *must* have
821820 the right size, or this will crash) */
@@ -833,8 +832,7 @@ font_render(FontObject *self, PyObject *args) {
833832 & anchor ,
834833 & foreground_ink_long ,
835834 & x_start ,
836- & y_start ,
837- & max_image_pixels )) {
835+ & y_start )) {
838836 return NULL ;
839837 }
840838
@@ -879,15 +877,11 @@ font_render(FontObject *self, PyObject *args) {
879877
880878 width += stroke_width * 2 + ceil (x_start );
881879 height += stroke_width * 2 + ceil (y_start );
882- if (max_image_pixels != Py_None ) {
883- if ((long long )(width > 1 ? width : 1 ) * (height > 1 ? height : 1 ) > PyLong_AsLongLong (max_image_pixels ) * 2 ) {
884- PyMem_Del (glyph_info );
885- return Py_BuildValue ("(ii)(ii)" , width , height , 0 , 0 );
886- }
887- }
888-
889880 image = PyObject_CallFunction (fill , "s(ii)" , strcmp (mode , "RGBA" ) == 0 ? "RGBA" : "L" , width , height );
890- if (image == NULL ) {
881+ if (image == Py_None ) {
882+ PyMem_Del (glyph_info );
883+ return Py_BuildValue ("ii" , 0 , 0 );
884+ } else if (image == NULL ) {
891885 PyMem_Del (glyph_info );
892886 return NULL ;
893887 }
@@ -898,7 +892,7 @@ font_render(FontObject *self, PyObject *args) {
898892 y_offset -= stroke_width ;
899893 if (count == 0 || width == 0 || height == 0 ) {
900894 PyMem_Del (glyph_info );
901- return Py_BuildValue ("(ii)(ii)" , width , height , x_offset , y_offset );
895+ return Py_BuildValue ("ii" , x_offset , y_offset );
902896 }
903897
904898 if (stroke_width ) {
@@ -1116,7 +1110,7 @@ font_render(FontObject *self, PyObject *args) {
11161110 Py_DECREF (image );
11171111 FT_Stroker_Done (stroker );
11181112 PyMem_Del (glyph_info );
1119- return Py_BuildValue ("(ii)(ii)" , width , height , x_offset , y_offset );
1113+ return Py_BuildValue ("ii" , x_offset , y_offset );
11201114
11211115glyph_error :
11221116 if (im -> destroy ) {
0 commit comments