SDL_ttf sometimes can't be rendered to image

Hi, in my application I used SDL_ttf with FreeSansBold.ttf from KDE (I
think). The funny thing is sometimes SDL_ttf can’t render and make a
string surface. But if I restarted (sometimes numerous time) the
application again, it can make a surface. I used “TTF_RenderText_Solid” to
render the string. How can this be? Can anybody help me here? Thanks.

Fare thee well,
Bawenang R. P. P.----------------

“I live for my dream. And my dream is to live my life to the fullest.”

Which platform are you using?
Seems to work fine on Windows with SDL 1.2.11 and SDL_ttf 2.0.8.

/a

benang at cs.its.ac.id wrote:> Hi, in my application I used SDL_ttf with FreeSansBold.ttf from KDE (I

think). The funny thing is sometimes SDL_ttf can’t render and make a
string surface. But if I restarted (sometimes numerous time) the
application again, it can make a surface. I used “TTF_RenderText_Solid” to
render the string. How can this be? Can anybody help me here? Thanks.

I’m using Linux SuSE 10.0 with SDL 1.2.11 and SDL_ttf 2.0.8.

andreas said:

Which platform are you using?
Seems to work fine on Windows with SDL 1.2.11 and SDL_ttf 2.0.8.

/a

@benang_at_cs.its.ac wrote:

Hi, in my application I used SDL_ttf with FreeSansBold.ttf from KDE (I
think). The funny thing is sometimes SDL_ttf can’t render and make a
string surface. But if I restarted (sometimes numerous time) the
application again, it can make a surface. I used "TTF_RenderText_Solid"
to
render the string. How can this be? Can anybody help me here? Thanks.

Fare thee well,
Bawenang R. P. P.----------------

“I live for my dream. And my dream is to live my life to the fullest.”

I’m using Linux SuSE 10.0 with SDL 1.2.11 and SDL_ttf 2.0.8.

I found a similar problem on Windows which I could reproduce using the
showfont test program:
http://www.libsdl.org/cgi/viewvc.cgi/trunk/SDL_ttf/showfont.c?revision=2429

If I used the -solid switch, then it would only work if the string
contained no spaces:

Ok:
showfont.exe -solid c:\WINDOWS\Fonts\arial.ttf 32 "Hello!"
Font is generally 36 big, and string is 36 big

Broken:
showfont.exe -solid c:\WINDOWS\Fonts\arial.ttf 32 "Hello World!"
Couldn’t render text:

It turned out to be related to the version of freetype used. All ok with
freetype-2.1.10, above problem with freetype-2.2.1,

regards,
John.On Thu, Nov 23, 2006 at 08:06:01AM +0700, benang at cs.its.ac.id wrote:

andreas said:

Which platform are you using?
Seems to work fine on Windows with SDL 1.2.11 and SDL_ttf 2.0.8.

/a

benang at cs.its.ac.id wrote:

Hi, in my application I used SDL_ttf with FreeSansBold.ttf from KDE (I
think). The funny thing is sometimes SDL_ttf can’t render and make a
string surface. But if I restarted (sometimes numerous time) the
application again, it can make a surface. I used "TTF_RenderText_Solid"
to
render the string. How can this be? Can anybody help me here? Thanks.

Fare thee well,
Bawenang R. P. P.


“I live for my dream. And my dream is to live my life to the fullest.”


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

How do I know what type the freetype was?

John Popplewell said:> On Thu, Nov 23, 2006 at 08:06:01AM +0700, @benang_at_cs.its.ac wrote:

I’m using Linux SuSE 10.0 with SDL 1.2.11 and SDL_ttf 2.0.8.

I found a similar problem on Windows which I could reproduce using the
showfont test program:
http://www.libsdl.org/cgi/viewvc.cgi/trunk/SDL_ttf/showfont.c?revision=2429

If I used the -solid switch, then it would only work if the string
contained no spaces:

Ok:
showfont.exe -solid c:\WINDOWS\Fonts\arial.ttf 32 "Hello!"
Font is generally 36 big, and string is 36 big

Broken:
showfont.exe -solid c:\WINDOWS\Fonts\arial.ttf 32 "Hello World!"
Couldn’t render text:

It turned out to be related to the version of freetype used. All ok with
freetype-2.1.10, above problem with freetype-2.2.1,

regards,
John.

Fare thee well,
Bawenang R. P. P.


“I live for my dream. And my dream is to live my life to the fullest.”

Good question.

On Windows:On Fri, Nov 24, 2006 at 08:22:57AM +0700, benang at cs.its.ac.id wrote:

How do I know what type the freetype was?
===========================================================================
it’s tricky because freetype is statically linked into the
’SDL_ttf.dll’. A quick look didn’t reveal any obvious freetype-related
strings.
===========================================================================

On Gentoo:

$ emerge -p freetype

These are the packages that would be merged, in order:

Calculating dependencies… done!
[ebuild U ] media-libs/freetype-2.1.10-r2 [2.1.10]

which shows my installed [version]. I need to do an Update there.

$ locate SDL_ttf.so
/usr/lib/libSDL_ttf.so

which shows where it is located.

$ ldd /usr/lib/libSDL_ttf.so
linux-gate.so.1 => (0xffffe000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb7f16000)
libz.so.1 => /lib/libz.so.1 (0xb7ee5000)
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0xb7e7e000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7e6c000)
libc.so.6 => /lib/libc.so.6 (0xb7d52000)
libstdc++.so.5 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.so.5 (0xb7c98000)
libm.so.6 => /lib/libm.so.6 (0xb7c74000)
libdl.so.2 => /lib/libdl.so.2 (0xb7c70000)
/lib/ld-linux.so.2 (0x80000000)
libgcc_s.so.1 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libgcc_s.so.1 (0xb7c68000)

which shows that SDL_ttf is linked to libfreetype.so.6

$ ls -l /usr/lib/libfreetype*
-rw-r–r-- 1 root root 539476 Mar 9 2006 /usr/lib/libfreetype.a
-rwxr-xr-x 1 root root 818 Mar 9 2006 /usr/lib/libfreetype.la
lrwxrwxrwx 1 root root 20 Mar 9 2006 /usr/lib/libfreetype.so -> libfreetype.so.6.3.8
lrwxrwxrwx 1 root root 20 Mar 9 2006 /usr/lib/libfreetype.so.6 -> libfreetype.so.6.3.8
-rwxr-xr-x 1 root root 1360789 Mar 23 2004 /usr/lib/libfreetype.so.6.3.3
-rwxr-xr-x 1 root root 453276 Mar 9 2006 /usr/lib/libfreetype.so.6.3.8

which shows I’m not sure what exactly :slight_smile: I think the .6.3.8 is libtool-related…

On Debian:

$ apt-cache search libfreetype
libcoin40c2 - high-level 3D graphics kit with Open Inventor and VRML97 support - runtime
libfreetype6 - FreeType 2 font engine, shared library files
libfreetype6-dev - FreeType 2 font engine, development files
libgd-gd2-noxpm-perl - Perl module wrapper for libgd - gd2 variant without XPM support
libgd-gd2-perl - Perl module wrapper for libgd - gd2 variant
libttf-dev - FreeType 1 development files (static library and headers)
libttf2 - FreeType 1, The FREE TrueType Font Engine, shared library files

$ apt-cache show libfreetype6

Version: 2.2.1-2

$ ls -l /usr/lib/libfreetype*
-rw-r–r-- 1 root root 521600 2006-05-19 22:29 /usr/lib/libfreetype.a
-rw-r–r-- 1 root root 820 2006-05-19 22:29 /usr/lib/libfreetype.la
lrwxrwxrwx 1 root root 21 2006-06-22 02:19 /usr/lib/libfreetype.so -> libfreetype.so.6.3.10
lrwxrwxrwx 1 root root 21 2006-06-21 22:28 /usr/lib/libfreetype.so.6 -> libfreetype.so.6.3.10
-rw-r–r-- 1 root root 443032 2006-05-19 22:29 /usr/lib/libfreetype.so.6.3.10

===========================================================================

Not sure about SuSE. I found this online package DB:
http://www.novell.com/products/linuxpackages/suselinux/index_all.html
which suggests that if you are up to date and using their packages you are
using SDL-1.2.9, SDL_ttf-2.0.6 and freetype-2.1.10.

Did you build from source or get (RPM?) packages from elsewhere?

The SDL_ttf-2.0.8 RPM package on the SDL site links to whatever version of
freetype is installed on your system.

Maybe you could try this (or equivalent on SuSE):
$ ls -l /usr/lib/libfreetype*
and see what you get?

Or if you’re setup to build applications (you’ve installed the -devel-
packages) why not build ‘showfont’:
http://www.libsdl.org/cgi/viewvc.cgi/trunk/SDL_ttf/showfont.c?view=co

using this:
$ gcc -oshowfont sdl-config --cflags --libs -lSDL_ttf showfont.c

use this to find a font (I’m assuming you’ve got locate/updatedb installed):
$ locate -i freesans

then run it with something like this:
$ ./showfont -solid /usr/share/fonts/truetype/freefont/FreeSans.ttf 32 "Hello"
which works, or this:

$ ./showfont -solid /usr/share/fonts/truetype/freefont/FreeSans.ttf 32 "Hello World"
which on my Debian (with freetype-2.2.1) does this:
Couldn’t render text: Failed loading DPMSDisable: /usr/lib/libX11.so.6: undefined symbol: DPMSDisable

or this:
$ ./showfont /usr/share/fonts/truetype/freefont/FreeSans.ttf 32 "Hello World"
works fine.

All work on my Gentoo box and on Windows (with freetype-2.1.10).
Of course, none of this may have anything to do with your problem :slight_smile:

regards,
John.

John Popplewell said:

On Thu, Nov 23, 2006 at 08:06:01AM +0700, benang at cs.its.ac.id wrote:

I’m using Linux SuSE 10.0 with SDL 1.2.11 and SDL_ttf 2.0.8.

I found a similar problem on Windows which I could reproduce using the
showfont test program:
http://www.libsdl.org/cgi/viewvc.cgi/trunk/SDL_ttf/showfont.c?revision=2429

If I used the -solid switch, then it would only work if the string
contained no spaces:

Ok:
showfont.exe -solid c:\WINDOWS\Fonts\arial.ttf 32 "Hello!"
Font is generally 36 big, and string is 36 big

Broken:
showfont.exe -solid c:\WINDOWS\Fonts\arial.ttf 32 "Hello World!"
Couldn’t render text:

It turned out to be related to the version of freetype used. All ok with
freetype-2.1.10, above problem with freetype-2.2.1,

regards,
John.

Fare thee well,
Bawenang R. P. P.


“I live for my dream. And my dream is to live my life to the fullest.”


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

John Popplewell wrote:

On Windows:

it’s tricky because freetype is statically linked into the
’SDL_ttf.dll’. A quick look didn’t reveal any obvious freetype-related
strings.

It is built against v2.1.10 if I remember correctly.

And the “space”-bug is fixed in their CVS according to this thread;

http://www.mail-archive.com/freetype at nongnu.org/msg00802.html

So an alternate solution is to try the very latest cvs-snapshots and see if the problems are solved.

/a

Thanks alot. I’ll try that.

andreas said:

John Popplewell wrote:

On Windows:

it’s tricky because freetype is statically linked into the
’SDL_ttf.dll’. A quick look didn’t reveal any obvious freetype-related
strings.

It is built against v2.1.10 if I remember correctly.

And the “space”-bug is fixed in their CVS according to this thread;

http://www.mail-archive.com/freetype at nongnu.org/msg00802.html

So an alternate solution is to try the very latest cvs-snapshots and see
if the problems are solved.

/a

Fare thee well,
Bawenang R. P. P.----------------

“I live for my dream. And my dream is to live my life to the fullest.”

John Popplewell wrote:

On Windows:

it’s tricky because freetype is statically linked into the
’SDL_ttf.dll’. A quick look didn’t reveal any obvious freetype-related
strings.

It is built against v2.1.10 if I remember correctly.

And the “space”-bug is fixed in their CVS according to this thread;

http://www.mail-archive.com/freetype at nongnu.org/msg00802.html

So an alternate solution is to try the very latest cvs-snapshots and see if the problems are solved.
Thanks!On Fri, Nov 24, 2006 at 08:01:57AM +0100, andreas wrote:

/a


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