How do I Change spritefont width according to text entered.

Get help using Construct 2

Post » Sat Aug 05, 2017 8:53 pm

For example: spritefont+
I have the text: "I'm very noob in construct 2" Width=700 Height=50. In the project to perfectly visualize all the text.
But if I change the text to: "I am very noob in construct 2 because I do not understand english very well" Width=700 Height=50. Already in the project I only see: ""I am very noob in construct 2 because I do no" Text no longer fits current width. Do you have any way to modify the Spritefont.width automatically by calculating the last inserted text? Thank you =D
B
21
S
2
Posts: 43
Reputation: 947

Post » Sun Aug 06, 2017 7:01 am

After you change the text use:

...SpriteFont| Set width to len(SpriteFont.Text)*SpriteFont.CharacterWidth("A")

You should use any character in 'SpriteFont.CharacterWidth'.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests