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

Legacy GM "string_width" calculating wrong value?

Silversea

Member
Perhaps someone with more experience could explain what is happening here, and how to correct it. I'm assuming it has something to do with spacing of the characters in the font not matching with the actual draw length.

The actual draw width of this text is 153 pixels, but the game says it is 228, which is skewing the line break code.

 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
You are most likely calculating string width prior to setting the desired font via draw_set_font - as one can expect, it uses the whichever font that is currently set to be used for drawing text.
 

Silversea

Member
I didn't actually consider setting those variables outside of the draw event, but, now I think about it, that would make a lot of sense. I think that is exactly what is happening. Thanks.
 
Top