Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

What's the most recommended format should I use for fonts, OTF or TTF or another?

In looking for:

  • Performance/Efficiency with SDL_ttf library
  • Free/Open-ness [1]

[1] I'm planning to use GPL3 and Open Font License.

share|improve this question
1  
I would recommend using Bitmap fonts for the performance. –  Martijn Courteaux Oct 21 '12 at 16:10
2  
@MartijnCourteaux And what are the cons? –  Sidar Oct 21 '12 at 16:34
3  
With Bitmaps fonts you can easily add extra decorations. The main problem with BMP fonts is it do not scale well, you will not get pixel perfect visuals in every possible resolution. TTF in the other hand works well in any resolution, but can be slower to generate each glyph. Also, chinese characters in a(many) Bitmap texture(s) would be hard to accomplish. –  AranHase Oct 21 '12 at 17:30
1  
@Zhen TTF also has width variation, and kerning. If you use a Bitmap font generator software like BMFont (AngelCode) or Hiero, it will give you a text file including all this information. Just read it, and map this information for each glyph. –  AranHase Oct 21 '12 at 18:01
1  
Bitmap fonts are faster to loader and simpler to implement, rendering them however isn't slower if cached (which is very common). Personally I would use TTF fonts because of the much higher flexiblity. –  Mr. Beast Oct 21 '12 at 18:49
show 2 more comments

1 Answer

up vote 3 down vote accepted

If you want to use SDL_ttf, then you have no choice but using TTF fonts, see the doc:

SDL_ttf supports loading fonts from TrueType font files, normally ending in .ttf, though some .fon files are also valid for use.

Now if OTF is still an option you would consider (even if there's no SDL_otf, which means you'll have to implement it), it's potentially a better choice than TTF, for the reasons exposed here. It's also an open standard so that's a +1 for free/open-ness.

Still, fonts in game engines are usually simple bitmaps, for performance reasons. So if you're actually writing a game and performance is an issue, use an offline bitmap font generator as you were suggested in comments.

share|improve this answer
    
Well, I think that bitmaps are the thing to use. –  Zhen Oct 22 '12 at 20:11
    
Not true, use OTF then generate a bitmap cache of the font in the user's current resolution then load from the bitmap cache. Re-cache when resolution changes / font size changes –  Pacerier Feb 24 '13 at 6:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.