[SDL] Fwd: Strange SDL_TTF problem (repost)

John Popplewell john at johnnypops.demon.co.uk
Wed Nov 16 13:59:19 PST 2005


On Wed, Nov 16, 2005 at 10:02:49PM +0100, SkunkGuru wrote:
> (I hope that all the list receives this message,
> this time... let me know if it's ok)
> 
> I have a small game that uses SDL and SDL_TTF.
> 
> With official SDL_TTF DLL v2.0.6 it's ok.
> 
> With official SDL_TTF DLL v2.0.7 I notice
> that texts are not very good-looking...
> 
> I don't know how to explain the problem,
> so I attach 2 samples (only 6kb)...
> 
> bad.png  is with SDL_ttf v2.0.7
> good.png is with SDL_ttf v2.0.6
> 
> I get this by *only* replacing the DLL file...
> (no changes in code, no changes in other DLL)
> 
> I tryed with my compiled program (.exe)
> - one folder with the .exe and the old DLL
> - one folder with the .exe and the new DLL
> (and the same sdl.dll and font.tff)
> 
> I run the programs, and take the snapshots
> 
> My system is WindowsXP.
> 
> I've also tryed both SDL.dll v1.2.8
> and SDL.dll v1.2.9 with the same problem.
> (official dll files from devel package)
> 
> This is a minimal program...
> and I still get the same problem...
> 
> I've also tryed changing the font file :-(
> 
> #include "SDL.h"
> #include "SDL_TTF.h"
> 
> int main( int argc, char* argv[] )
> {
>     SDL_Init(SDL_INIT_VIDEO);
>     TTF_Init();
> 
>     SDL_Surface* screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE);
> 
>     TTF_Font* Font = TTF_OpenFont("font.ttf", 16);
>     TTF_SetFontStyle(Font, TTF_STYLE_NORMAL);
> 
>     SDL_Color myCol;
>     myCol.r = 255; myCol.g = 255; myCol.b = 255;
>     SDL_Surface* Surface2 = TTF_RenderText_Solid(Font, "this is a test
> string" , myCol);
> 
>     SDL_Rect myRect;
>     myRect.x = 320;
>     myRect.y = 240;
> 
>     SDL_BlitSurface(Surface2, NULL, screen, &myRect);
>     SDL_Flip(screen);
> 
>     SDL_Delay(2000);
> 
>     return 0;
> }
> 
> 
> Any idea ?
> 
Hi,

sounds like the problem is with SDL_ttf. SDL_ttf uses the FreeType
library which has (or had, potentially) some kind of patent problem
related to the font 'hinting' for True-Type fonts. There is a page
devoted to this topic here: 

http://www.freetype.org/patents.html

Consequently, there is a compile-time option in FreeType that
enables/disables the problematic 'bytecode interpreter' - perhaps this
was enabled for one version of the library, but not the other.

Why don't you try building your own version of SDL_ttf and the FreeType
library and experiment with this setting?

cheers,
John Popplewell.





More information about the SDL mailing list