• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • 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?

S

Silversea

Guest
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.
 
S

Silversea

Guest
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