GMS 2 long Jap text not cut to new line

saga55555

Member
Hi, I have problem with Japanese text. My English text work fine but Jp not cut to new line when it longer than length limit. Both texts use the same code.
JP text use font_add to store .tff to global.variable when start game. I try to use this font to draw Eng, still no problem. Only draw JP.
Code:
txt = instance_create(argument2,argument3,obj_text);
with (txt)
{
    padding = 20;
    maxlength = __view_get( e__VW.WView, 0 )-580;
    text = argument0;
    spd = argument1;
    font = global.jap_font;
    
    text_length = string_length(text);
    font_size = font_get_size(font);    
    draw_set_font(font);
    
    text_width = string_width_ext(string_hash_to_newline(text),font_size+(font_size/2), maxlength);
    text_height = string_height_ext(string_hash_to_newline(text),font_size+(font_size/2), maxlength);
}
Here result image of Eng/JP dialogue link : https://imgur.com/a/L6A4b9u
Anyone know the cause and how to fix? Thank you :D
 

Rob

Member
I wonder if it's because you're using a font you made.

You could try modifying the code by using string_width for your variable "text_length" to see if that helps.
 

Tsa05

Member
Having trouble locating the problem because none of the code here performs text wrapping or text drawing.
(I do notice that you are using string_hash_to_newline, though...if your text has manually inserted line breaks in it then it's behaving as intended...)
 

saga55555

Member
I wonder if it's because you're using a font you made.

You could try modifying the code by using string_width for your variable "text_length" to see if that helps.
Thank you for your reply. I just have time to test it and nothing change.
Maybe problem isn't come from code but gms doesn't know with word should break to new line in Japanese.
I tested and it randomly break some sentence that have (space bar) near max_length. Seem like I have to line break manually D:
 

saga55555

Member
Having trouble locating the problem because none of the code here performs text wrapping or text drawing.
(I do notice that you are using string_hash_to_newline, though...if your text has manually inserted line breaks in it then it's behaving as intended...)
Thank you for your respond and sorry that I forgot to show my draw code. I using draw_text_ext.
I decided to line break manually now anyway.
 
Hello everyone! :)
I am having the same problem, but in my case there is no way to break the line manually because all the dialogs of my game are linked in a single system, I would have to rewrite all the dialogs :(

Is there any other way to fix this problem? I using draw_text_ext.
 
Last edited:

Yal

šŸ§ *penguin noises*
GMC Elder
Manually insert linebreaks on the string after reading it, but BEFORE drawing it:
upload_2019-9-10_22-4-32.png
(intentionally posting a screenshot so you at least gotta type this thing out for yourself, maybe learning a thing or two in the process)

Also, please start your own topics instead of hijacking old ones that has been dead for half a year and also has a different issue than you.
 
Top