PDA

View Full Version : cyrillic


lennard
05-07-2007, 12:29 PM
Has anybody supported Cyrillic before? Previously I have been able to support other languages using the expanded ASC II set. I'm looking for a sprite set based solution (as opposed to doing TTF rendering on the fly) although I would be interested in hearing anybodies experiences with this issue and the Russian software market in general.

Thanks.

ggambett
05-07-2007, 05:34 PM
I know this isn't what you're expecting, but I strongly recommend you use TTF. You can get away with sprites for russian, but once you decide to do japanese, korean and chinese you'll regret not having done TTF support before ;)

lennard
05-07-2007, 08:04 PM
Thanks for the feedback Gabriel.

Do you just use and distribute free TTF files? As you may have guessed I am dealing with porting REE to Cyrillic and I don't want to rely on using fonts that I find on my end users computer.

ggambett
05-07-2007, 08:52 PM
Effectively, you can't rely on specific fonts installed in the computer, so you have to license the fonts or find freely distributable ones. In the case of CJK the company doing the localization pointed us to free fonts.

James C. Smith
05-07-2007, 10:00 PM
It is also risky to rely on the operating system to render the TTF font since they each do it differently. Win98 will render the same TTF differently than WinXP will. FreeType is a great way to go.

esmelon
05-08-2007, 12:13 AM
I think sprite set based solution is the best.

Here is ASCII table with russian language (MSDOS Codepage 855)
http://www.ascii.ca/cp855.htm

Nikster
05-08-2007, 02:12 AM
And windows will use Windows Cyrillic, Code Page 1251 :D we just had a nightmare with it because we used directx to report back the string each keyboard character was pressed, "shift" "a" etc etc, but I assumed unicode, get the gun ;)

esmelon
05-08-2007, 02:51 AM
It is not a problem, I can send you russian keyboard layout (qwerty)
table to map direct input keys to MS-DOS Codepage 855 ;)

Grey Alien
05-08-2007, 05:40 AM
I was just looking into this yesterday too. I got a Unicode text file reading in and drawing Cyrillic characters using Arial.ttf, but I don't think that can be distributed legally as it probably belongs to Microsoft.

At some point I'm going to have to localise in Japanese, sounds like it might be a headache ...

lennard
05-09-2007, 06:42 PM
Hi all, I'm back to the Cyrillic project. I don't currently have a use for an Asian version of the software so I am interested in a quick and dirty port to a 256 character Asc II set if possible. Actually, for my own evil purposes, I probably want to eventually support 256 character translations and a TTF on the fly renderer... but not right now if I can avoid it.

Using wordpad I can read and write a 16-bit text file and, looking at the hex codes, I see that the Russian characters are all in the 1000+ range - Esmelon, or anyone, do you have any idea how to translate those into the Russian Asc II set that you have shown?

And, Esmelon or anyone else, do you know of a TTF font that maps Cyrillic letters to those lower ranges? While I'm at it, Gabriel, do you know the name of the free Cyrillic font you have been using - I've seen several online today but they are all commercial. I know I may actually need to buy something here but I would like to see the free alternatives first.

Thanks.

ggambett
05-09-2007, 08:23 PM
While I'm at it, Gabriel, do you know the name of the free Cyrillic font you have been using
No, sorry. We haven't actually translated our games to russian. We did translate to japanese and korean. I just was saying that supporting TTF is a better long-term solution and a good idea in general.

esmelon
05-10-2007, 06:40 AM
If you want use TTF font, i think you need to use WIN-1251 charset and font must have Cyrillic charset support.
Arial, Arial Black, Courier New, Impact, Times New Roman, Verdana have Cyrillic support by default.

Here is tool for get extended information about font:
http://www.microsoft.com/typography/TrueTypeProperty21.mspx

Here is win-1251 table http://www.microsoft.com/globaldev/reference/sbcs/1251.mspx

And you need create font with RUSSIAN_CHARSET

font = CreateFont(-MulDiv(12, LogPixelSY, 72),
0,
0,
0,
FW_NORMAL,
0,
0,
0,
RUSSIAN_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE | DEFAULT_PITCH,
"Arial");


If you want use unicode here is source code of java script to convert win-1251 (or koi8-r) to UNICODE:
http://www.solaris.opennet.ru/tips/info/915.shtml
and this can be used to make inverse convert.

Also you can read this article
http://www-128.ibm.com/developerworks/linux/library/l-u-cyr/
and maybe this http://koi8.pp.ru/main.html


But I still think that sprite based solution more easy to implement.

Nikster
05-10-2007, 08:47 AM
If you're using windows API for your tools, multibytetowidechar and widechartomultibyte are your friends for codepage conversion.

If you really need/want to just use a byte for a character that's easy also, thankfully the Russian set isn't as big as the Asian ones :) so if you write your own custom converter, which should take minutes, you can have Ascii, Extended Ascii and Cyrillic all in the range 0-255 (with all the uneeded junk removed of course) and has been said, will be easier using bitmaps and mapped accordingly.

lennard
05-25-2007, 11:42 AM
I did end up writing my own converter which I am making available here:

http:/www.rustyaxe.com/downloads/UniToAsc.exe

It's got a nice little windows UI on it and a simple help dialog. It loads a unicode file and then writes out a remapping file for your TTF converter and an ASCII version of the unicode file with the characters remapped. My upcoming game tool, Font Fiend, will use the output from UniToAsc automatically but I am releasing it here for anybody who might have use of it with their own TTF renderer.