Really? The following code works absolutely fine on my machine;
----- 8< -----
#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>
int
main ( void )
{
TTF_Font *font;
char *filename;
// This works
if ( TTF_Init() == -1 )
{
fprintf ( stderr, “Unable to initialize SDL_TTF: %s\n”,
TTF_GetError () );
return 1;
}
// This is where it burns
filename = “timesi.ttf”;
font = TTF_OpenFont ( filename, 9 );
if ( font == NULL )
{
fprintf ( stderr, “Unable to open default TTF font: %s\n”,
TTF_GetError () );
return 1;
}
TTF_CloseFont ( font );
TTF_Quit ();
return 0;
}
----- 8< -----
Compiled with;
gcc -O2 -Wall -lSDL -lSDL_ttf -o test test.c
I’m using SDL 1.2.7, ttf version 2.0.6 and gcc version 3.3.3 on Gentoo.
The timesi.ttf font I used is from the corefonts package available from
http://corefonts.sourceforge.net/
HTH,
MattOn Fri, 2004-04-16 at 05:08, Coleman Nitroy wrote:
Documentation for SDL_ttf seems a it lacking so I am stabbing the the
dark here, and from the demo and documentation I was able to scrap
together this for initializing SDL_ttf, but it crashes and burns
every-time:[Code]
TTF_Font *font
char *filename// This works
if( TTF_Init() == -1 ) {
fprintf(stderr, “Unable to initialize SDL_TTF: %s\n”, TTF_GetError());
return 1;
}// This is where it burns
filename = FreeMono.ttf";
font = TTF_OpenFont(filename, 9);
if( font == NULL ) {
fprintf(stderr, “Unable to open default TTF font: %s\n”,
TTF_GetError());
return 1;
}[/Code]
–
http://www.mattsscripts.co.uk/
- A great source for free CGI and stuff
It is one of the superstitions of the human mind to have imagined that
virginity could be a virtue.
– Voltaire