• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Discussion Any experience with HEBREW?

Eran_Mi

Member
Does anyone here had experience (or knowledge) how to use Hebrew fonts with GameMaker 2? i need it to work cross platform... don't mind the left to right issues but need to display Hebrew fonts.

Eran
 

FrostyCat

Member
I've posted about drawing Hebrew on GMS before, and this is what I know from my last brief exploration of the topic.
  • You must set a font containing Hebrew glyphs and include the range 1424-1535.
  • You should be able to receive input via get_string_async() or keyboard_string.
  • You need to wrap Hebrew strings drawn to the screen using a script that manually reverses its Hebrew portions.
The example project in that old post is long gone, but a rough recreation of it is available here. The wrapper script is this:
Code:
///@func Hebrew(str)
///@param str
var hebrew_mode = false;
var result = "";
var mode_start = 1;
var mode_run = 0;
var strlen = string_length(argument0);
for (var i = 1; i <= strlen; i++) {
    var c = string_char_at(argument0, i);
    var oc = ord(c);
    var hebrew_mode_now = oc >= $590 && oc <= $5FF;
    if (hebrew_mode != hebrew_mode_now || i == strlen) {
        if (i == strlen) {
            mode_run++;
        }
        if (hebrew_mode) {
            var run = "";
            for (var ii = mode_start+mode_run-1; ii >= mode_start; ii--) {
                run += string_char_at(argument0, ii);
            }
            result = run + result;
        } else {
            result = string_copy(argument0, mode_start, mode_run) + result;
        }
        mode_start = i;
        mode_run = 1;
    } else {
        mode_run++;
    }
    hebrew_mode = hebrew_mode_now;
}
return result;
Do note that I don't have any actual experience in the language myself, so there will likely be use cases that I overlooked. But this is a foundation you can work from if you wish.
 
Top