CJK support
Posted: Tue Feb 11, 2014 10:56 pm
yuyingchenk expressed an interest in a Chinese translation. There's a bunch of work required to make this happen.
yuyingchenk has started a Chinese Mandarin translation, so I have a few strings to work with. I set up GNU Unifont as the UI font for the cmn translation (a terrible font, but convenient for testing). I had to add the CJK Unified range to TextureFont, and expand the atlas size because there's a lot of characters, but that was enough to get here:
There's no way this is releasable in its current state - its actually quite unstable because of the size of the glyph atlas. But at least it shows we're not that far away!
So we have a few things to do. I think we'll need to do on-demand generation of the glyph atlas. Wildfire Games did an excellent write-up about the text renderer they built for 0 A.D. There's a lot to like about it (and its open-source, so I'll look into stealing it). But anyway, section 8 of that talks about their Unicode support.
We need to select a good-quality font that fits with the game. For Cyrillic there wasn't much out there so we had to go with Deja Vu, which isn't really the right style for the game but was all we had. I suspect we'll be in a similar situation here.
We have no support for combining characters/diacritics/ligatures/digraphs/etc. We've largely gotten away with it so far. I don't know if CJK text will require this. We have options that we've discussed (including handing off text layout to harfbuzz/pango), but I think we'll continue to ignore it until it comes up, and then deal with it in the lightest way we can.
I think that's actually about it for text display. There is another side to full CJK support though, which is input. I don't really know much about this, just the term "IME" really. I see that I have alternate on-screen keyboards and things like that available on my system, so it shouldn't be much effort to test and come up with something. Fortunately we don't do a lot of text input, so I'm hopeful that this won't be a significant problem.
Please post notes and helpful links here, I'm reading everything I can :)
yuyingchenk has started a Chinese Mandarin translation, so I have a few strings to work with. I set up GNU Unifont as the UI font for the cmn translation (a terrible font, but convenient for testing). I had to add the CJK Unified range to TextureFont, and expand the atlas size because there's a lot of characters, but that was enough to get here:
There's no way this is releasable in its current state - its actually quite unstable because of the size of the glyph atlas. But at least it shows we're not that far away!
So we have a few things to do. I think we'll need to do on-demand generation of the glyph atlas. Wildfire Games did an excellent write-up about the text renderer they built for 0 A.D. There's a lot to like about it (and its open-source, so I'll look into stealing it). But anyway, section 8 of that talks about their Unicode support.
We need to select a good-quality font that fits with the game. For Cyrillic there wasn't much out there so we had to go with Deja Vu, which isn't really the right style for the game but was all we had. I suspect we'll be in a similar situation here.
We have no support for combining characters/diacritics/ligatures/digraphs/etc. We've largely gotten away with it so far. I don't know if CJK text will require this. We have options that we've discussed (including handing off text layout to harfbuzz/pango), but I think we'll continue to ignore it until it comes up, and then deal with it in the lightest way we can.
I think that's actually about it for text display. There is another side to full CJK support though, which is input. I don't really know much about this, just the term "IME" really. I see that I have alternate on-screen keyboards and things like that available on my system, so it shouldn't be much effort to test and come up with something. Fortunately we don't do a lot of text input, so I'm hopeful that this won't be a significant problem.
Please post notes and helpful links here, I'm reading everything I can :)