[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] BUG: Segfault/failure rendering non-AA text with a background



Hi,

At some point, Pygame on Debian starting having issues rendering non-AAd
text with background colors, for certain strings (ones containing only
spaces, at least). It also segfaults on empty non-AA strings.

>>> import pygame
>>> pygame.init()
open /dev/sequencer: No such file or directory
(6, 0)
>>> f = pygame.font.Font(None, 20)
>>> f.render("foo", True, [0, 0, 0], [255, 255, 255])
<Surface(20x18x8 SW)>
>>> f.render("   ", True, [0, 0, 0], [255, 255, 255])
<Surface(12x18x8 SW)>
>>> f.render("", True, [0, 0, 0], [255, 255, 255])
<Surface(1x18x32 SW)>
>>> f.render("foo", False, [0, 0, 0], [255, 255, 255])
<Surface(20x18x8 SW)>
>>> f.render("   ", False, [0, 0, 0], [255, 255, 255])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
pygame.error: SDL_ttf render failed
>>> f.render("   ", False, [0, 0, 0])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
pygame.error: SDL_ttf render failed
>>> f.render("", False, [0, 0, 0], [255, 255, 255])
Fatal Python error: (pygame parachute) Segmentation Fault
Aborted

To summarize: AA text always renders. Non-AA text fails:
 - If the string is empty, by a segfault.
 - If the string is blank (all spaces), by a pygame.error, regardless
   of bg color or lack thereof.

Non-AA text succeeds if the string is empty and no bg color is given, or
if the string contains non-space characters.

I'm guessing it's related to a recent change in freetype or SDL_ttf;
it's not the first time such a change has popped up. Unfortunately I
don't have time to track down the bug more and write a patch, sorry.
-- 
Joe Wreschnig <piman@xxxxxxxxxxxxxx>

Attachment: signature.asc
Description: This is a digitally signed message part