Efficient font rendering for languages with many glyphs?

Started by
2 comments, last by mikiex 11 years, 8 months ago
For Latin fonts I was planning to render all the glyphs to a texture atlas (and that seems to be what people suggest doing), but looking at Japanese fonts with possibly 10k glyphs, or fallback fonts for internationalization that cover the entire unicode basic multilingual plane (64k glyphs), I'm concerned that doing that naively is going to be a disaster in both ram use and number of textures. I figure this is a common problem as there are a lot of Asian and multilingual games, but I couldn't find any info on it. How would you do it?
Advertisement
Many people would just rely on FreeType.
I use uniscribe instead, with an LRU scheme on a large cache. The cache evicts seldom used glyphs when exceeding a certain memory threshold. I think it's about 8 MiB for now but it never kicked in. Note Uniscribe appears to have its own cache as well.

Previously "Krohm"

The answer kind of depends on how you are using text in your game.
I've been working on several games where all text was predetermined. We just extracted all texts for a specific language from our localization database and ran this through BMfont (http://www.angelcode.com/products/bmfont). This tool allows you to create font textures only containing characters found in a specified file. This removed the need for us to include the font itself (which was about 12MB, too huge).

If you're using texts for chat or something you would need to include the font since you dont know which characters users will use. Like Krohm suggets you could use some caching. Maybe you can even swap in and out characters that are or arent currently used, if you are doing this maybe you can place your characters in an evenly spaced grid so that you wont have issues with replacing small characters with large ones.
You could try using signed distance fields if these are bitmap fonts to save some memory.
I second what Murdock says, projects I have worked on that required japanese we scan through all the text looking for all the unique unicode. We then created a bitmap font based on this. The font wasn't too big, but with more characters packed into the same amount of space we used on the european font means the quality is reduced (was acceptable to the Japanese publisher)

This topic is closed to new replies.

Advertisement