Problems with SDL_ttf

I was writing a looooooooong question a few minutes ago and accidently
pressed send before I was done…

So I will stripp it down… What could make SDL crash when I use SDL_ttf and
call TTF_Render_UTF8_Solid? I pass a strings .c_str() and I works fine until
I try to pass a string that contains charaters like ?, ?, ? etc…

Best regards
Daniel_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus

After some serrious inspection I discovered that the problem was NOT in
SDL_ttf…

Thanks for your time
Daniel>From: “Damien Damien” <@Daniel_Liljeberg>

Reply-To: sdl at libsdl.org
To: sdl at libsdl.org
Subject: [SDL] Problems with SDL_ttf
Date: Tue, 29 Jul 2003 15:04:47 +0200

I was writing a looooooooong question a few minutes ago and accidently
pressed send before I was done…

So I will stripp it down… What could make SDL crash when I use SDL_ttf
and call TTF_Render_UTF8_Solid? I pass a strings .c_str() and I works fine
until I try to pass a string that contains charaters like ?, ?, ? etc…

Best regards
Daniel


MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus

Hello;

I’m trying to put some text on the screen, but it doesn’t seem to work.
Here is the code:

if(TTF_Init()==-1) {
printf(“TTF_Init: %s\n”, TTF_GetError());
exit(2);
}
TTF_Font *font;
font=TTF_OpenFont(“arial.ttf”, 16);
if(!font) {
printf(“TTF_OpenFont: %s\n”, TTF_GetError());
}
SDL_Color fg={0,0,0,255};
SDL_Surface *text_surface;
if(!(text_surface=TTF_RenderText_Solid(font,“a”,fg))) {
printf(“Oh My Goodness, an error : %s\n”, TTF_GetError());
}

When I run the program, it only prints the “Oh my goodness…” statement
but no further error.
I have tried some fonts(also a few freshly downloaded) but none of them
seemed to work.

Any help appreciated;
Thank You,
Gregor K.–
Using M2, Opera’s revolutionary e-mail client: http://www.opera.com/m2/

I’m using quite a same code but with “TTF_RenderUTF8_Blended()”.
Can you try with it ?

Gregor Kasieczka wrote:

Hello;

I’m trying to put some text on the screen, but it doesn’t seem to work.
Here is the code:

if(TTF_Init()==-1) {
printf(“TTF_Init: %s\n”, TTF_GetError());
exit(2);
}
TTF_Font *font;
font=TTF_OpenFont(“arial.ttf”, 16);
if(!font) {
printf(“TTF_OpenFont: %s\n”, TTF_GetError());
}
SDL_Color fg={0,0,0,255};
SDL_Surface *text_surface;
if(!(text_surface=TTF_RenderText_Solid(font,“a”,fg))) {
printf(“Oh My Goodness, an error : %s\n”, TTF_GetError());
}

When I run the program, it only prints the “Oh my goodness…” statement
but no further error.
I have tried some fonts(also a few freshly downloaded) but none of them
seemed to work.

Any help appreciated;
Thank You,
Gregor K.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040706/cf94ae9f/attachment.pgp

I’m using quite a same code but with “TTF_RenderUTF8_Blended()”.
Can you try with it ?

Wow…great, works perfectly…
Thank you very much

Ciao GregorOn Tue, 06 Jul 2004 15:18:41 +0200, Nuage wrote:

Using M2, Opera’s revolutionary e-mail client: http://www.opera.com/m2/

http://qtnode.net/index.php/pastebin/4607
There’s the code.

I’m just getting the blank screen and no text shows up. I’m compiling in linux
using the following commands:
g++ -o test *.cpp -lSDL -lSDL_ttf -lfreetype

Any ideas?

I have proved your code.

I have changed two things the first is at compilation:
g++ -o test test.cc -lSDL -lSDL_ttf (it’s not necessary to use freetype).

The other one is when the program loads the font:

TTF_OpenFont(other path,28) (this is not important)

It goes like you expect, the program load and prints “Text goes here” in
a white background.

Be sure to have the font in the correct place, and if its in the same
dir, you can try to change the path to “./whatever.ttf”, maybe this goes.

PD:Sorry for my poor English.

Zaka.

Zaka E-Lab <shanatorio gmail.com> writes:

I have proved your code.

I have changed two things the first is at compilation:
g++ -o test test.cc -lSDL -lSDL_ttf (it’s not necessary to use freetype).

The other one is when the program loads the font:

TTF_OpenFont(other path,28) (this is not important)

It goes like you expect, the program load and prints “Text goes here” in
a white background.

Be sure to have the font in the correct place, and if its in the same
dir, you can try to change the path to “./whatever.ttf”, maybe this goes.

PD:Sorry for my poor English.

Zaka.

We figured out the what they problem was in the SDL irc channel. Turns out
TTF_RenderText_Solid is not supported on linux. I had to use
TTF_RenderText_Shaded.

Shame though since according to the docs solid is faster =/

Hello !

We figured out the what they problem was in the SDL irc channel. Turns out
TTF_RenderText_Solid is not supported on linux. I had to use
TTF_RenderText_Shaded.

Is this a problem with SDL_ttf or with Freetype itself ?

CU

As far as I’m concerned, I use TTF_RenderText_Solid fine under
GNU/Linux - except that I needed to upgrade FreeType to v2.3.5. The
FreeType package included in Debian Etch, and apparently Fedora Core 6
as well, has a bug.On Wed, Sep 05, 2007 at 01:40:16PM +0200, Torsten Giebl wrote:

Hello !

We figured out the what they problem was in the SDL irc channel. Turns out
TTF_RenderText_Solid is not supported on linux. I had to use
TTF_RenderText_Shaded.

Is this a problem with SDL_ttf or with Freetype itself ?


Sylvain

I don’t know if i have understood your message, have you told
TTF_RenderText_Solid is not supported o Linux?

I so then I ought tell you that I’ve compiled it under Linux, so the
function goes well on Linux.

Zaka.