How do I adjust the size of a 'text object' based on the amount of text it contains?

0 favourites
  • 6 posts
From the Asset Store
220 Food Sprites in 16x16 pixel size. Perfect for items for a retro style game.
  • Is there a way to automatically adjust the size of a 'text box' based on the amount of text it contains, so that it shows all the text, and obviously on runtime.

    Tagged:

  • Yes, you can use TextObject.TextHeight/TextWidth to get the size of the actual text and set the size of the object from there.

  • Thank you so much.

  • Yes, you can use TextObject.TextHeight/TextWidth to get the size of the actual text and set the size of the object from there.

    Hi, GeoffB, I just have one doubt.

    The logic works great; however, when I use the TextObject.TextHeight/TextWidth logic, the font becomes blurry, especially when the font size is big, like in my case with a size of 60. Is there any way to make it crisp? Or is it handled by the browser, so it's random, and we can't really do much about it?, Or is it a bug in C3?

    I have attached an image to demonstrate the issue more prominently

    And here the C3p

  • My requirement is to change the font size of the text in real-time, which is why I need that logic. However, the issue is that the text becomes blurry.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hmm, I recreated your example and don't have this issue.

    Assuming there's nothing else in your code setting size or anything, I suspect it's a rendering issue, not Construct itself. Try running it on multiple devices to see if the issue persists, and/or update your drivers and web browser.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)