pioneerspacesim/pioneer — pull request #1647 by johnbartholomew (2012-10-29 22:04:33+00:00)
Title: Basic Cyrillic support

This adds basic support for rendering cyrillic characters, *if the underlying font provides them*. This is a rudimentary patch which just updates the current TextureFont system to include cyrillic glyphs in the glyph atlas. It is not intended to be a long term solution, but rather to provide just enough support to allow Russian translation work to continue, and to hopefully avoid turning away potential Russian developers.

For a longer term approach, I expect us to need proper font fallback to cope with characters that aren't in the current font. I also expect us to switch to a shared glyph atlas, with dynamic updates to add glyphs as they are needed (possibly adding them in blocks, i.e., if you use one character from the basic Unicode Cyrillic range it could add all glyphs in that range in one update). We may also need to use a glyph shaping/layout library like HarfBuzz (I think ICU also includes glyph layout code) to properly cope with more complex language features (we would definitely need it if we want to support non-western scripts).

Limitations of this temporary patch:

* At larger font sizes, not all the glyphs fit into the atlas. This would be trivial to fix by bumping up the glyph atlas size. I'm not sure whether we want to pay that extra resource cost at this stage though (I don't know how much texture memory we're using right now, or what our targets should be).
* There is no fallback mechanism; characters that aren't in the font just aren't rendered. This effectively means that to be useful, all used fonts need to provide cyrillic characters.
* As far as I know, none of our existing fonts provide cyrillic glyphs. Combined with the previous point, this means that to use cyrillic you have to completely replace all the current fonts. Luckily, this is quite easy to do as a mod.

(*) I'm not sure -- combining marks might "just work" by having an advance value of 0 in the glyph information (so the renderer ends up automatically overlaying the combining mark with the next character).