Strange SDL_TTF problem

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 2.0.7
good.png is with 2.0.6

I get this only replacing the DLL…
Any idea ?

Thanks!–
SkunkGuru.
-------------- next part --------------
A non-text attachment was scrubbed…
Name: bad.PNG
Type: image/png
Size: 2249 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051023/71bd4200/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed…
Name: good.PNG
Type: image/png
Size: 2127 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051023/71bd4200/attachment-0001.png

Forgot to say my system is WindowsXP.

I’ve tryed

SDL.dll v1.2.8
and
SDL.dll v1.2.9

with the same problem.–
SkunkGuru.

This is a minimal program…
and I still get the same problem…

I’ve also tryed changing the font file :frowning:

#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;

}–
SkunkGuru.

Hey there,

Maybe the Windows implementation of SDL_ttf is different, but it should use
the system’s TTF renderer… So are you sure the only update was to SDL_ttf?
You could also compile SDL_ttf yourself and, if the problem persists,
checkout the source code that shouldn’t be that big, since SDL_ttf is just a
wrapper (maybe doing a diff against the former version).

Anyway, if possible, you should consider rendering your vectorial TTF files
to a raster format and use it in the game. You’d avoid extra dependencies,
rendering glitches, and the associated speeddown.

Cheers,
RicardoEm Domingo 23 Outubro 2005 17:07, o SkunkGuru escreveu:

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 2.0.7
good.png is with 2.0.6

I get this only replacing the DLL…
Any idea ?

Thanks!


Your life would be very empty if you had nothing to regret.

Ricardo Cruz ha scritto:

So are you sure the only update was to SDL_ttf?

yes, I tryed with the 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

so, no other change :frowning:

You could also compile SDL_ttf yourself and, if the problem persists,
checkout the source code that shouldn’t be that big, since SDL_ttf is just a
wrapper (maybe doing a diff against the former version).

yes, I know I can do this… (I love open-source ^_^)
I was wondering if someone else has got this problem…

Anyway, if possible, you should consider rendering your vectorial TTF files
to a raster format and use it in the game. You’d avoid extra dependencies,
rendering glitches, and the associated speeddown.

you mean creating a big graphic file (for example PNG)
with all the letters inside, and then create texts by
blitting the letters, right ?

Yes, I know that maybe is a better solution, but for
now performance is not a problem since are very simple
2d-game (like pacman or arkanoid) :slight_smile:

and I like the idea that anyone can change the
TTF file with his favourite font ;-)–
SkunkGuru.

Hello SkunkGuru,

Tuesday, October 25, 2005, 5:55:18 AM, you wrote:

You could also compile SDL_ttf yourself and, if the problem persists,
checkout the source code that shouldn’t be that big, since SDL_ttf is just a
wrapper (maybe doing a diff against the former version).

yes, I know I can do this… (I love open-source ^_^)
I was wondering if someone else has got this problem…

I just want to mention that SDL_ttf is not the only existing lib that
renders TTF for SDL. You can try my library - Glyph Keeper:
http://kd.lab.nig.ac.jp/glyph-keeper/
It was mainly made for Allegro, but it has now basic SDL support.–
Best regards,
Kirill mailto:@Kirill_Kryukov

Ricardo Cruz ha scritto:

Anyway, if possible, you should consider rendering your vectorial TTF
files to a raster format and use it in the game. You’d avoid extra
dependencies, rendering glitches, and the associated speeddown.

you mean creating a big graphic file (for example PNG)
with all the letters inside, and then create texts by
blitting the letters, right ?

In the case of those fonts that approach will not work all that well, since
those are not mono-spaced. A better approach could be storing individual
characters in individual files with its ASCII code as filename.

Yes, I know that maybe is a better solution, but for
now performance is not a problem since are very simple
2d-game (like pacman or arkanoid) :slight_smile:

and I like the idea that anyone can change the
TTF file with his favourite font :wink:

Yes, but TTF fonts are, in my opinion, a hassle too big to ignore. For one,
they are hard to edit and the most beatiful fonts that are free for use
generally don’t include enough characters for internationalization.
For games, I very much prefer to adopt a raster format. If you can draw SVG,
it might also be a good idea.

For small old-school games, I’ve found that drawing the fonts in the code
using lines gives you pretty nice results.

Cheers,
RicardoEm Segunda 24 Outubro 2005 21:55, o SkunkGuru escreveu:

Coincidence, n.:
You weren’t paying attention to the other half of what was
going on.

so nobody else has this problem ?

nobody uses SDL_ttf ?

so nobody else has this problem ?

What was your problem?

nobody uses SDL_ttf ?

I use SDL_ttf in Tux Paint, and have used it elsewhere.
I’ve seen some various problems, but at the moment, nothing critical
that breaks Tux Paint.

-bill!On Tue, Nov 01, 2005 at 10:16:00PM +0100, SkunkGuru wrote:

so nobody else has this problem ?

I am sorry. I believe I missed your original message.

nobody uses SDL_ttf ?

I use SDL_ttf and have had no problems with it.

ChrisOn 11/1/05, SkunkGuru wrote:


E-Mail: Chris Nystrom
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris

(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 :frowning:

#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 ?

Thanks!
-------------- next part --------------
A non-text attachment was scrubbed…
Name: bad.PNG
Type: image/png
Size: 2249 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051102/4225ec02/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed…
Name: good.PNG
Type: image/png
Size: 2127 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051102/4225ec02/attachment-0001.png

Do you load the DLL dinamycally in your code? Or do you use the
.lib? If the latter is your option, you should recompile with the .lib
matching the new version. Probably the addresses of the functions don’t
match if you’ve changed the DLL. You can use the implib utility (I use the
borland compiler and this utility comes with the bundle). I had similar
problems using the wrong .lib when changing the dll versions.

Let us know if that was the problem.++++++++++++++++++++++++++++++++

ALBERT FERNANDEZ MARSAL
CIRSA INTERACTIVE CORP. SL
Analista senior y programador
++++++++++++++++++++++++++++++++

-----Mensaje original-----
De: sdl-bounces+afmarsal=cirsa.com at libsdl.org
[mailto:sdl-bounces+afmarsal=cirsa.com at libsdl.org] En nombre de SkunkGuru
Enviado el: mi?rcoles, 02 de noviembre de 2005 22:09
Para: sdl at libsdl.org
Asunto: [SDL] Strange SDL_TTF problem (repost)

(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 :frowning:

#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 ?

Thanks!

Albert Fern?ndez Marsal ha scritto:

Do you load the DLL dinamycally in your code? Or do you use the
.lib?

I use the .lib

If the latter is your option, you should recompile with the .lib
matching the new version. Probably the addresses of the functions don’t
match if you’ve changed the DLL.

I already recompiled with the new .lib :frowning:

(Forgot to say I’m using VS2003)

Any idea ?

It looks like the ‘bad’ fonts have been rendered with the bytecode interpreter
switched off. The bytecode interpreter can only be used legally with a licence
from Apple as it uses their patents. To switch it on, in the freetype source
code, find the file include/freetype/config/ftoption.h and remove the comments
(or #undef, depending on the version you have) so there’s a line that reads:

#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER

  • Steve

Quoting SkunkGuru :> (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 :frowning:

#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 ?

Thanks!

Albert Fern?ndez Marsal ha scritto:

Do you load the DLL dinamycally in your code? Or do you use the
.lib?

I use the .lib

If the latter is your option, you should recompile with the .lib
matching the new version. Probably the addresses of the functions don’t
match if you’ve changed the DLL.

I already recompiled with the new .lib :frowning:

(Forgot to say I’m using VS2003)

Any idea ?

Thanks!

(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 :frowning:

#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 ?

Thanks!
-------------- next part --------------
A non-text attachment was scrubbed…
Name: bad.PNG
Type: image/png
Size: 2249 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051116/f42b68e2/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed…
Name: good.PNG
Type: image/png
Size: 2127 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051116/f42b68e2/attachment-0001.png

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.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 :frowning:

#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 ?