Sign in to follow this  

Font issues

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm getting in a bit of a state working out how fonts work for games. Assume a game is cross-platform and multi-lingual, I clearly don't go creating my own font of thousands of characters, so how does this work? Do I specify what font to use on each OS for each language and hope it exists - if it doesn't what would be the next step? Also, it seems the best way is to use a truetype font and then create a bitmap of it, but how does that get around the problem of something like an m taking up as much room as a comma, it would look a little silly...

Share this post


Link to post
Share on other sites
You generally license a truetype font and generate a bitmap font with the glyphs you need. If the game makes advanced use of fonts, then the ttf can also be rendered on the fly.

You can and should not rely that a font available on the users computer. It's not guaranteed that it will be there and be what you expect it to be and there are possible licensing issues to consider as well.

As for your problem with the m and the comma: it is not a problem, unless you want each of your glyphs to have the same width. For even prettier font rendering, look up the term "kerning".

Share this post


Link to post
Share on other sites
So, I'm guessing that more often than not a game actually uses a number of fonts (or just one big one), one for each particular language - Latin, and perhaps another 3 for CJK? I'm also trying to work out exactly what something like the FreeType library actually does and what it's purpose is?

Thank you.

Share this post


Link to post
Share on other sites
Freetype can read all sorts of font formats and render them.

I used Freetype previously to render glyphs from a truetype font to pixel buffers for dynamically building a bitmap at whatever resolution I needed.

Share this post


Link to post
Share on other sites
Quote:
Original post by NewBreed
So, I'm guessing that more often than not a game actually uses a number of fonts (or just one big one), one for each particular language - Latin, and perhaps another 3 for CJK?


That really depends on the situation. If you use prerendered glyphs ("bitmap fonts"), what you describe is a sensible approach. You can further optimise by preprocessing all your texts that end up on the screen to find out, which glyphs you actually need.

An alternative is to use libraries like freetype to render glyphs on the fly. This is more complicated and probably slower, but also a lot more flexible. Beware that many aspects of font rendering are covered by patents! The freetype docu has a lot of info on this.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this