one of my pygame users has dug up a rare crashing bug in SDL_ttf.
his solution here is to simply add 1 to the width of the rendered
image.> ----- Original Message -----
From: niki@vintech.bg (Niki Spahiev)
To:
Sent: Friday, March 16, 2001 4:30 AM
Subject: [pygame] SDL_ttf 1.2.2 BUGI found one very hard to reproduce bug in SDL_ttf.
Due to rounding of gliph->bitmap.width sometimes
gliph->minx + gliph->bitmap.width > gliph->maxxThis leads to no enough width for allocated surface and Seg_faults.
I fixed it by incrementing ‘w’ from TTF_SizeUNICODE before
SDL_AllocSurface e.g.:/* Get the dimensions of the text surface */ if ( (TTF_SizeUNICODE(font, text, &w, &h) < 0) || !w ) { TTF_SetError("Text has zero width"); return(NULL); } /* Create the target surface, 32-bit ARGB format */ width = w; w++; !!! w = (w+3)&~3; textbuf = SDL_AllocSurface(SDL_SWSURFACE, w, h, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
I am not sure that this is enough, but it works for me.
regards,
Niki Spahiev