# SDL Your method for text

This topic is 5142 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

:'( This really pisses me off. Not being able to print text in the screen is painful ( you can only draw it with images ). So i thought someone could be using something different instead of always having to have a special image with the aphabet to print text. Do you all include the text image in the data folder of your projects, or do you do a magical trick? Thanks..

##### Share on other sites
Check out SDL_ttf at http://www.libsdl.org/projects/SDL_ttf/

##### Share on other sites
What daeron said. SDL_ttf is probably the best solution to display text with SDL. It even supports Unicode and anti-aliased fonts.

It doesn't rely on a font being installed in the user's system. You supply the font yourself with your game. (I'm mentioning this because this is what scared me off at first from using a TTF library.)

If you want something simpler (in terms of size; SDL_ttf is easier to use), check out SFont at http://www.linux-games.com/sfont/ - it loads fonts from an image file. Of course, it's restricted to ASCII characters.

SDL_gfx also includes a simple, built-in font renderer including a font.

##### Share on other sites
thank you for the replies... but SDK__ttf does require you to supply a font ( http://jcatki.no-ip.org/SDL_ttf/SDL_ttf_frame.html ). or am i wrong?

edit how do i make a link work..?

##### Share on other sites
Quote:
 Original post by sdlprorammerthank you for the replies... but SDK__ttf does require you to supply a font ( http://jcatki.no-ip.org/SDL_ttf/SDL_ttf_frame.html ). or am i wrong?edit how do i make a link work..?
Yes, you have to suppy a font. Google for the "Bitstream Vera" fonts, which very nice, and freely redistributable.

<a href="http://www.website.com">text to show</a>

Don't forget the http:// part, or it won't work.

##### Share on other sites
Or you can just make your own text fucntions, it takes only a few hours of coding, and you get some experience as well, plus you don't need any dependencies, and you can customize it to whatever extent you want.

##### Share on other sites
ok thank you all!

##### Share on other sites
IIRC, the SDL_ttf demos file comes with a couple of fonts which may be used freely. Those are from the freefonts project.

ok..

##### Share on other sites
Try SFont.

It's great if you don't want to use a font file, but want to use a bitmap font, which for me, was easier than creating a .ttf for my font.

Really simple and easy to use.

-Skitzo

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
16
5. 5

• 9
• 12
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632593
• Total Posts
3007271

×