YoYo Games Wiki

Cyrillic Character Support

From YoYoGames Wiki

Some or all of the functions in this article may work only in the registered version of Game Maker.

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 7.0 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.

Image:Hebrew_Font.jpg

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');