[SDL] SDL_ttf & Mac OS Classic

Jesse David Andrews jdandr2 at uky.edu
Tue May 20 08:40:02 PDT 2003


I am trying to port TuxTyping 2 to Mac Classic (for schools).  I had successfully ported it in the past but after getting another old mac and installing MPW and all the SDL libraries (the latest ones SDL_ttf 2.0.6, ...)

I got the Mixer & Image libaries working, but I cannot get TTF_OpenFont to work.

I cut down to the smallest possible example:

#include "SDL.h"
#include "SDL_ttf.h"

int main(int argc, char *argv[]) {
  SDL_Surface *screen;
  TTF_Font *font;

  if (SDL_Init(SDL_INIT_VIDEO)<0)
     exit(1);

  screen = SDL_SetVideoMode(640,480,16,SDL_SWSURFACE);

  if (TTF_Init() < 0)
    exit(1);

  font = TTF_OpenFont( "FreeSans.ttf", 24 );
  if (!font) {
    printf("font could not be loaded :(\n");
    exit(1);
  }

  printf("everything worked!\n");

  return 0;
}

----------------------------------

No problems compiling (the library was installed in exactly the same way as SDL_image & mixer and both of those libraries worked)

It always prints that the font cannot be loaded.  I am using the freefonts from the GNU savanah Free Font project (TTF fonts).  I have used the about every combination of things I can think of!  

The funny thing is that if I try to open the font as a file (using fopen), it succeeds!  so it doesn't seem to be a pathing issue.

Thanks for any help in advance!

Jesse Andrews
http://tux4kids.net/~jdandr2








More information about the SDL mailing list