Unicode fonts in XNA


The XNA font system supports full Unicode character sets.

The default XML font description includes only characters 0x20 to 0x7E, which corresponds to the “Basic Latin” Unicode range, but you can easily add other character regions by modifying the XML file. For European languages you will typically want some of the “Latin-1” and perhaps the “Latin Extended” ranges. See http://www.unicode.org/charts for a complete list of what is available.

Japanese, Chinese, and Korean characters are located in the “Unified CJK Ideographs” range, but these languages present a special challenge for game developers. Because they have so many characters, converting their entire Unicode range would produce an enormous font and take up way too much memory. Fortunately most games only ever use a tiny subset of the possible characters, so you can optimize the font size by including only those characters the game is going to need. You can do this by writing a custom processor that reads in whatever text resources the game is using, scans over all the characters in this text, and selectively adds just those characters to the font being converted.

Our text layout engine is very simple and does not support combining characters, so it cannot handle languages with complex layout rules such as Arabic or Thai.


Comments (3)

  1. Shawn Hargreaves Blog announces the release of the Game State Management sample . His blog entry on Transitions

  2. Boyan Bonev says:

    Hello,

    If I want to use Cyrillc, what I must write here: "…encoding="HERE"…"?

  3. ShawnHargreaves says:

    > If I want to use Cyrillc, what I must write here

    http://www.unicode.org/charts lists what character sets are represented by all the Unicode code points.