Commits

Marcus von Appen  committed 660a7a5

- issue #58: raise a proper error, if FontManager.render() could not render a
text surface

  • Participants
  • Parent commits 9778d1c

Comments (0)

Files changed (1)

File sdl2/ext/font.py

 """Font and text rendering routines."""
 import os
 from .. import surface, rect, pixels
+from .common import SDLError
 from .compat import *
 from .sprite import SoftwareSprite
 from .color import Color, convert_to_color
             surface = sdlttf.TTF_RenderUTF8_Blended(font, text, color)
         else:
             surface = sdlttf.TTF_RenderUTF8_Shaded(font, text, color, bg_color)
+        if not surface:
+            raise SDLError(sdlttf.TTF_GetError())
         return surface.contents