Font Support

Does anyone know of a way to use fonts with SDL?
I’ve looked at the libraries off the SDL site, but I couldn’t get any of
them to work.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!
There are many ways. You could for example just paste bitmaps.Am Sonntag, 18. Januar 2004 21:44 schrieb Kevin Fields:

I’ve looked at the libraries off the SDL site, but I couldn’t get any of
them to work.

Did you try SDL_ttf. That one is really easy to use. The only thing is that
the font-file has to reside in the workingdirectory of your programm (or you
have to specify the full path).
If that’s not the problem, what do you mean by: “Not getting it to work”?

regards
Matthias/www.libsdl.org/mailman/listinfo/sdl


Matthias Bach | GPG/PGP-Key-ID: 0xACA73EC9
www.marix-world.de | On Keyserver: www.keyserver.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFACveWlnJmS6ynPskRAkr+AJ4wPj08YpyfwcEJKHEQa8gyEcdZ7ACeKYk6
cBal3ibokm5FNBaHU3Q3++s=
=8TS6
-----END PGP SIGNATURE-----

http://libsdl.org/projects/SDL_ttf/
If you couldn’t get it to work, why not? Perhaps you should post your
problems.

Bernhard

Kevin Fields wrote:> Does anyone know of a way to use fonts with SDL?

I’ve looked at the libraries off the SDL site, but I couldn’t get any of
them to work.


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

I’ve tried using SDL_ttf, but I keep getting the following error when I
attempt to compile the program:

‘g_Font’ uses undefined struct ‘_TTF_Font’

I have FreeType 2.1.5, SDL 1.2.6, and SDL_ttf 2.0.6 all installed.
I’m including SDL_ttf.h, and yes, the directory where that file resides is
in my Directories list.
I tried to do the SDL & Fonts article from GameDev.net, which uses SDL_ttf,
but I always got that error when I tried to compile it.> ----- Original Message -----

From: bernhard.bliem@chello.at (Bernhard Bliem)
To:
Sent: Sunday, January 18, 2004 5:33 PM
Subject: Re: [SDL] Font Support

http://libsdl.org/projects/SDL_ttf/
If you couldn’t get it to work, why not? Perhaps you should post your
problems.

Bernhard

Kevin Fields wrote:

Does anyone know of a way to use fonts with SDL?
I’ve looked at the libraries off the SDL site, but I couldn’t get any of
them to work.


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


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

Kevin Fields wrote:

I’ve tried using SDL_ttf, but I keep getting the following error when I
attempt to compile the program:

‘g_Font’ uses undefined struct ‘_TTF_Font’

Would you post the corresponding line (plus some context) from the source?
BTW, don’t hijack threads:


Christian
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040123/b291ca77/attachment.pgp

This is something along the lines of what I have in the source code:

<–CODE–>
#include <SDL.h>
#include <SDL_ttf.h>

TTF_Font g_Font; <--------- This is the line that gives me the error.
<–/CODE–>

The rest of it seems irrelevant at this point, because I’m just trying to
create the variable, and that’s not working. One thing I’m wondering, does the
TTF_Font variable have to be a pointer?-------------------------
Kevin Fields
kevin at thedorvo.net

<–CODE–>
#include <SDL.h>
#include <SDL_ttf.h>

TTF_Font g_Font; <--------- This is the line that gives me the error.
<–/CODE–>

g_Font must be a pointer to TTF_Font. Try

TTF_Font *g_Font;

KentaroFrom: kevin@thedorvo.net (Kevin Fields)
Subject: Re: [SDL] Font Support
Date: Fri, 23 Jan 2004 07:52:03 -0500 (EST)

Ok, I’ll give that a try when I get home.

Quoting Kentaro Fukuchi :> From: Kevin Fields

Subject: Re: [SDL] Font Support
Date: Fri, 23 Jan 2004 07:52:03 -0500 (EST)

<–CODE–>
#include <SDL.h>
#include <SDL_ttf.h>

TTF_Font g_Font; <--------- This is the line that gives me
the error.
<–/CODE–>

g_Font must be a pointer to TTF_Font. Try

TTF_Font *g_Font;

Kentaro


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


Kevin Fields
kevin at thedorvo.net

That fixed it.
It’s odd that it would give me an undefined error for not having it declared
as a pointer… weird> ----- Original Message -----

From: fukuchi@is.titech.ac.jp (Kentarou Fukuchi)
To:
Sent: Friday, January 23, 2004 8:57 AM
Subject: Re: [SDL] Font Support

From: Kevin Fields
Subject: Re: [SDL] Font Support
Date: Fri, 23 Jan 2004 07:52:03 -0500 (EST)

<–CODE–>
#include <SDL.h>
#include <SDL_ttf.h>

TTF_Font g_Font; <--------- This is the line that gives me the
error.

<–/CODE–>

g_Font must be a pointer to TTF_Font. Try

TTF_Font *g_Font;

Kentaro


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

That fixed it.
It’s odd that it would give me an undefined error for not having it
declared
as a pointer… weird

Not that odd, really – SDL_ttf is defining the structure with “struct
TTF_Font;”, so the implimentation details are hidden from you – this allows
it to change that implimentation in the future, and not make you, an
application developer, have to recompile your source code to use the new
functionality (when using as a shared library [.dll, .so – whatever your
system calls it]). Doesn’t really effect you, other than only being able to
make pointers to it – a good thing, since you shouldn’t be passing around
stack values that might be getting pointed-to by elsewhere, and since you
should never be directly modifying the values TTF_Font uses anyways.

  • Silicon

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.562 / Virus Database: 354 - Release Date: 1/16/2004

----- Original Message -----
From: kevin@thedorvo.net (Kevin Fields)
To:
Sent: Friday, January 23, 2004 7:57 AM
Subject: Re: [SDL] Font Support