[Suggestion] SpriteFont Global Character Width

Discussion and feedback on Construct 2

Post » Fri Jul 12, 2013 3:18 pm

It would be helpful to have the "Set character width" action apply globally to the Sprite Font. Whenever I create new text, I have to set the character widths again. I can't think of a case where I wouldn't want it to be a global change.

Thanks
B
79
S
51
G
39
Posts: 370
Reputation: 24,705

Post » Fri Jul 12, 2013 3:35 pm

I may be misunderstanding the issue, but you shouldn't have to set the characters widths for each new text within a project. The widths should carry over to each instance of the spritefont. If you're using multiple spritefont objects, and want to set all their character widths, you could add them to a family, and set the character widths of the family. zatyka2013-07-12 15:35:58
B
62
S
19
G
8
Posts: 341
Reputation: 12,075

Post » Fri Jul 12, 2013 4:07 pm

Doesn't seem to work for me. I have one Spritefont object. At the title screen I set the character widths and they appear correctly. When I start playing the game and spawn a new Spritefont instance, I have to set the character widths again.

B
79
S
51
G
39
Posts: 370
Reputation: 24,705

Post » Fri Jul 12, 2013 4:20 pm

This is where a function will help you. Pass in the UID, pick it, and set your character widths there. Call it on the title screen too.
ImageImageImage
B
71
S
21
G
220
Posts: 3,649
Reputation: 123,727

Post » Fri Jul 12, 2013 4:24 pm

Yeah that should work. But for ease of use, I think the default should just be a global change.
B
79
S
51
G
39
Posts: 370
Reputation: 24,705

Post » Fri Jul 12, 2013 4:25 pm

Ah, I see what you mean now. It looks like character widths are only saved per layout. A default character width property sounds like a good idea. In the meantime, you could create a event sheet specifically for setting the the character widths, and include it on the other event sheets.
B
62
S
19
G
8
Posts: 341
Reputation: 12,075

Post » Fri Jul 12, 2013 4:31 pm

Setting the character widths in the 'On created' event should fix it without needing any functions or anything else.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Fri Jul 12, 2013 4:33 pm

Even better. Thanks for the help!
B
79
S
51
G
39
Posts: 370
Reputation: 24,705


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests