1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GM:S 1.4 "string_width" calculating wrong value?

Discussion in 'Legacy GameMaker Community Tech Support' started by Silversea, Jan 25, 2018.

  1. Silversea

    Silversea Member

    Joined:
    Jun 22, 2016
    Posts:
    64
    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.

    [​IMG]
     
  2. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,445
    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 likes this.
  3. Silversea

    Silversea Member

    Joined:
    Jun 22, 2016
    Posts:
    64
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice