@@ -181,7 +181,7 @@ def draw_path(self, gc, path, transform, rgbFace=None):
181181 poly_points = []
182182
183183 for point , code in path .iter_segments (transform ):
184- logger .debug (point , code )
184+ logger .debug (f" { point = } , { code = } " )
185185 if code == Path .LINETO :
186186 draw_func (self .surface , color , previous_point , point )
187187 previous_point = point
@@ -239,6 +239,11 @@ def draw_image(self, gc, x, y, im):
239239 )
240240
241241 def draw_text (self , gc , x , y , s , prop , angle , ismath = False , mtext = None ):
242+
243+ logger .info (
244+ f"Drawing text: { s = } at ({ x = } , { y = } ) with { angle = } and ismath={ ismath } "
245+ f"{ mtext = } { prop = } { gc = } "
246+ )
242247 # make sure font module is initialized
243248 if not pygame .font .get_init ():
244249 pygame .font .init ()
@@ -249,6 +254,9 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
249254 font_surface = myfont .render (
250255 s , gc .get_antialiased (), [val * 255 for val in gc .get_rgb ()]
251256 )
257+ if angle :
258+ font_surface = pygame .transform .rotate (font_surface , angle )
259+
252260 # Get the expected size of the font
253261 width , height = myfont .size (s )
254262 # Tuple for the position of the font
@@ -311,6 +319,8 @@ def points_to_pixels(self, points):
311319 # return points/72.0 * self.dpi.get()
312320
313321 def clear (self ):
322+ if not hasattr (self , "surface" ):
323+ return
314324 self .surface .fill ("white" )
315325
316326 def copy_from_bbox (self , bbox ):
0 commit comments