I have noticed that using #print on an SDL::TTFont in blended mode aborts with an empty error string. I don't understand why TTFPutString considers a surface created with the text to be incorrect if it has no palette, I think this is an error, hence my proposed (verified) patch is attached. IMHO blended mode is really a minimum today and I would then also propose blended rather than shaded mode by default in SDL::TTFont (I doubt people are really using SDL::TTFont on anything else than solid backgrounds because of this bug in blended mode).
I have another, more minor, problem with SDL::TTFont. Printing an empty string aborts with an empty error; SFont (SDL::Font) which I was using before didn't have this behaviour, and to be honest, I prefer this situation or else I'll need to write a wrapper around #print since what I print is dynamic and sometimes is empty. The following in #print as first statement would seem to be enough: length(join('', @text)) > 0 or return; -- Guillaume Cottenceau - http://zarb.org/~gc/
--- SDL_Perl-2.1.2/src/SDL_perl.xs 2005-10-02 17:33:28.000000000 +0200 +++ SDL_perl.xs 2006-05-23 20:30:23.000000000 +0200 @@ -3062,11 +3062,13 @@ dest.w = w; dest.h = h; } - if ( img && img->format && img->format->palette ) { - SDL_Color *c = &img->format->palette->colors[0]; - Uint32 key = SDL_MapRGB( img->format, c->r, c->g, c->b ); - SDL_SetColorKey(img,SDL_SRCCOLORKEY,key ); - if (0 > SDL_BlitSurface(img,NULL,surface,&dest)) { + if ( img && img->format ) { + if ( img->format->palette ) { + SDL_Color *c = &img->format->palette->colors[0]; + Uint32 key = SDL_MapRGB( img->format, c->r, c->g, c->b ); + SDL_SetColorKey(img,SDL_SRCCOLORKEY,key ); + } + if (0 > SDL_BlitSurface(img,NULL,surface,&dest)) { SDL_FreeSurface(img); RETVAL = NULL; } else {