Game Maker Tip: Cyrillic Support
The fonts in Game Maker do not support Cyrillic characters or Hebrew, Arabic, Chinese or Japanese symbols. For users of the Pro Edition of Game Maker there is a rather easy way to achieve this though.
First you need a sprite that contains all the characters that you need as subimages. To this end go to the Windows Start menu, Choose Accessories/System Tools and start the Character Map. Find the correct collection of symbols you need and create a screenshot of them using some drawing program. For example you could create the following image of the hebrew symbols.
.
.
Now use the option to create a sprite from a strip to create a single sprite containing the symbols as subimages.
Next you need to use the function font_add_sprite(spr,first,prop,sep). This function creates a new font resource from a sprite. spr is the sprite that contains the symbols as subimages. first indicate the index of the first character in the sprite. For example, use ord('A') to let the first character symbol correspond to the capital letter A. prop indicates whether the font is proportional. In a proportional font, for each character the width of the bounding box is used as the character width. Finally, sep indicates the amount of white space that must separate the characters horizontally. A typical value would lie between 2 and 8 depending on the font size. The function returns the id of the font.
To draw a text with the symbols, set the font, and next draw a text. using the correct letters. For example, here is a possible piece of code. (Of course normally you would only create the font resource once and use it at different places).
globalvar hebrewfont;
hebrewfont = font_add_sprite(spr_hebrew,ord('A'),true,2);
draw_set_font(hebrewfont);
draw_text(100,100,'ACGFEDS');
I hope this helps.
15 Responses to “Game Maker Tip: Cyrillic Support”
Leave a Reply
You must be logged in to post a comment.

August 22nd, 2008 at 4:05 pm
cool. didn’t know that that was possible, not that it really helps me any, as I have no need for chineese charectors…
August 22nd, 2008 at 8:52 pm
Will GM support this by default in a later version?
August 22nd, 2008 at 11:24 pm
possibly…
it would be very cool…
also, can’t you download “chineese” fonts and import them into GM and use them that way?
August 23rd, 2008 at 1:11 am
@Caniac: I believe that chineese fonts use UTF-8 or something similar (more than 8-bits a character) whereas Game Maker can only support ascii fonts.
August 23rd, 2008 at 3:37 am
ahhh thanks. didn’t know…
August 23rd, 2008 at 2:27 pm
What is GLOBVAR ??
August 23rd, 2008 at 4:33 pm
Sorry. I meant globalvar. I corrected it.
- Mark
August 23rd, 2008 at 7:41 pm
Wont work for Arabic though.. its a complex script font..
August 23rd, 2008 at 10:19 pm
You can also use it for Arabic symbols but if you need more complicated texts than you can always put the whole text in a sprite.
- Mark
August 25th, 2008 at 6:55 am
You could also have a folder for each language with all of the sprites containing the text and have the “fonts” folder selectable in game. This way users could make their own translations.
August 25th, 2008 at 8:38 am
Now this is more like it. Some quality talk about game design with Gamemaker.
Thats a cool feature, althouth i cant think of when id use it.
August 25th, 2008 at 11:42 pm
[...] place to hang-out with updates and new posts nearly every week. Just three days ago Mark Overmars posted an article explaining methods of using Cyrillic characters and Hebrew, Arabic, Japanese, and Chinese fonts and [...]
August 28th, 2008 at 7:20 pm
Until today I didn’t know that GM fonts don’t support cyrillic charset. I made a lot of games in russian and they work fine. Did I do something wrong?
Really, if default charset in Windows is cp1251 you need not to do something for support cyrillic but set character range for font to 32-255. That works if you want to distribute executable game. If you want to share source, however, you must be sure that the receiver of your source set cp1251 as a default charset. If this is not true, provide compitible English version.
September 8th, 2008 at 12:43 pm
y not let Game Maker support all fonts `~`
October 25th, 2008 at 10:44 pm
[...] Recent public urls tagged “cyrillic” → Game Maker Tip: Cyrillic Support [...]