Issue with sdl_ttf?

I’m using sdl_ttf inside sdl component for Gambas
http://gambas.sourceforge.net

The code works great for pfa and pfb fonts, but fail with ttf font ! (p.e.
timersi.ttf from corefonts), i can get ascent,descent but failed (segfault)
when i try to get the size with TTF_SizeUTF8 or print text.

sdl-1.2.8, sdl_ttf-2.0.7 and freetype-2.1.5 under gentoo/x86–

Laurent Carlier

Le Lundi 21 F?vrier 2005 18:31, Laurent Carlier a ?crit?:

I’m using sdl_ttf inside sdl component for Gambas
http://gambas.sourceforge.net

The code works great for pfa and pfb fonts, but fail with ttf font ! (p.e.
timersi.ttf from corefonts), i can get ascent,descent but failed (segfault)
when i try to get the size with TTF_SizeUTF8 or print text.

sdl-1.2.8, sdl_ttf-2.0.7 and freetype-2.1.5 under gentoo/x86

Laurent Carlier


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

When enabling debuf in sdl_ttf gdb gives me the following output :

bash-2.05b$ gdb gbx2 core.20902
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for details.
This GDB was configured as “i686-pc-linux-gnu”…Using host libthread_db
library “/lib/libthread_db.so.1”.

Core was generated by `gbx2 -p’.
Program terminated with signal 11, Segmentation fault.

warning: current_sos: Can’t read pathname for load map: Erreur d’entr?e/sortie

Reading symbols from /lib/libm.so.6…done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libdl.so.2…done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libc.so.6…done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2…done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/local/lib/gambas2/lib.gb.sdl.so…done.
Loaded symbols for /usr/local/lib/gambas2/lib.gb.sdl.so
Reading symbols from /lib/libpthread.so.0…done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /usr/lib/libSDL-1.2.so.0…done.
Loaded symbols for /usr/lib/libSDL-1.2.so.0
Reading symbols
from //usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/libstdc++.so.5…done.
Loaded symbols for //usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/libstdc++.so.5
Reading symbols from /usr/lib/libasound.so.2…done.
Loaded symbols for /usr/lib/libasound.so.2
Reading symbols from /usr/lib/libX11.so.6…done.
Loaded symbols for /usr/lib/libX11.so.6
—Type to continue, or q to quit—
Reading symbols from /usr/lib/libXext.so.6…done.
Loaded symbols for /usr/lib/libXext.so.6
Reading symbols from /usr/lib/libvga.so.1…done.
Loaded symbols for /usr/lib/libvga.so.1
Reading symbols
from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/libgcc_s.so.1…done.
Loaded symbols for /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/libgcc_s.so.1
Reading symbols from /usr/local/lib/gambas2/lib.gb.sdl.image.so…
done.
Loaded symbols for /usr/local/lib/gambas2/lib.gb.sdl.image.so
Reading symbols from /usr/lib/libSDL_image-1.2.so.0…done.
Loaded symbols for /usr/lib/libSDL_image-1.2.so.0
Reading symbols from /usr/lib/libSDL_gfx.so.12…done.
Loaded symbols for /usr/lib/libSDL_gfx.so.12
Reading symbols from /usr/local/lib/libSDL_ttf-2.0.so.0…done.
Loaded symbols for /usr/local/lib/libSDL_ttf-2.0.so.0
Reading symbols from /usr/lib/libjpeg.so.62…done.
Loaded symbols for /usr/lib/libjpeg.so.62
Reading symbols from /usr/lib/libpng.so.3…done.
Loaded symbols for /usr/lib/libpng.so.3
Reading symbols from /lib/libz.so.1…done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /usr/lib/libtiff.so.3…done.
Loaded symbols for /usr/lib/libtiff.so.3
Reading symbols from /usr/lib/libfreetype.so.6…done.
Loaded symbols for /usr/lib/libfreetype.so.6
Reading symbols from /usr/lib/libXcursor.so.1.0.2…done.
Loaded symbols for /usr/lib/libXcursor.so.1.0.2
Reading symbols from /usr/lib/libXrender.so.1…done.
Loaded symbols for /usr/lib/libXrender.so.1
Reading symbols from /usr/lib/X11/locale/lib/common/xlcDef.so.2…
done.
Loaded symbols for /usr/lib/X11/locale/lib/common/xlcDef.so.2
Reading symbols from /usr/lib/gconv/ISO8859-15.so…done.
Loaded symbols for /usr/lib/gconv/ISO8859-15.so
#0 0xb7efba8c in memcpy () from /lib/libc.so.6
(gdb) bt
#0 0xb7efba8c in memcpy () from /lib/libc.so.6
#1 0xb7bf75d8 in SDL_FreeRW () from /usr/lib/libSDL-1.2.so.0
#2 0xb787a32e in RWread (stream=0x16c, offset=364,
buffer=0x16c <Address 0x16c out of bounds>, count=364)
at SDL_ttf.c:236
#3 0xb77638aa in FT_Stream_EnterFrame ()
from /usr/lib/libfreetype.so.6
#4 0xb77a38eb in TT_RunIns () from /usr/lib/libfreetype.so.6
#5 0xb779da06 in gray_raster_render ()
from /usr/lib/libfreetype.so.6
#6 0xb77a7e61 in TT_RunIns () from /usr/lib/libfreetype.so.6
#7 0xb7766721 in FT_Load_Glyph () from /usr/lib/libfreetype.so.6
#8 0xb787a94e in Load_Glyph (font=0x809e840, ch=116,
cached=0x80a0e7c, want=16) at SDL_ttf.c:435
#9 0xb787afba in Find_Glyph (font=0x809e840, ch=116, want=16)
at SDL_ttf.c:654
#10 0xb787b472 in TTF_SizeUNICODE (font=0x809e840, text=0xbffff186,
w=0xbffff1c4, h=0xbffff1c8) at SDL_ttf.c:886
#11 0xb787b39a in TTF_SizeUTF8 (font=0x16c, text=0x809e4d5 “toto”,
w=0x16c, h=0x16c) at SDL_ttf.c:831
#12 0xb7c50ff8 in FONT_height (_object=0x16c, _param=0x5b)
at font.c:195
#13 0x0804d2fd in EXEC_call_native (exec=0xb7c50fbb <FONT_height>,
—Type to continue, or q to quit—
object=0x809e1c8, type=364, param=0x806fb80) at gbx_exec.c:650
#14 0x0804d580 in EXEC_native () at gbx_exec.c:757
#15 0x0804f1ea in EXEC_loop () at gbx_exec_loop.c:1078
#16 0x0804d159 in EXEC_function_real (keep_ret_value=0 ‘\0’)
at gbx_exec.c:550
#17 0x0805d187 in main (argc=1, argv=0xbffff544) at gbx.c:274

with the simple gambas basic code :

PUBLIC SUB Main()
DIM myfont AS Font
myfont = NEW Font(“timesi.ttf”)
PRINT myfont.Height(“toto”)
END–

Laurent Carlier
-------------- next part --------------
A non-text attachment was scrubbed…
Name: font.c
Type: text/x-csrc
Size: 8383 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050224/c8fb3152/attachment.c
-------------- next part --------------
A non-text attachment was scrubbed…
Name: font.h
Type: text/x-chdr
Size: 1686 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050224/c8fb3152/attachment.h