Determining Spritefont Character Width

Discussion and feedback on Construct 2

Post » Wed Sep 28, 2016 6:09 pm

Is there a way if you create a spritefont manually (not from a normal font, so I can't use @blackhornet sprite font generator) to determine the character width for each character? I have no experience figuring this out, and I'd love to not have to type the entire alphabet into a text box and manually try every single potential option.

Any insight on this?

Thanks in advance.
B
41
S
12
G
1
Posts: 540
Reputation: 4,188

Post » Wed Sep 28, 2016 7:34 pm

There's no way around it, either you'll have to do it manually (by measuring the width of each character and using it in the code) or you could write a program yourself that measures the width of every character in a spritesheet I think?

Using blackhornet's program is the best way to go since it does all of this automatically though.
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Post » Thu Sep 29, 2016 6:20 am

@andryin

So just so I'm clear, are you subtracting the pixels from the edge of the letter to the cell box? How would I use blackhornet's program with an already created spritesheet?
B
41
S
12
G
1
Posts: 540
Reputation: 4,188

Post » Thu Sep 29, 2016 2:58 pm

There's no way to use his program with a .png spritesheet of a font I believe.

If you want to use it, you'll have to download a font, open the font in it and then export it.

When setting the character width you're just saying that your character has said width.

Image

In this case, for the letter A I should put an event saying:

"On start of level -> spritefont -> set character width "A" to 5"

So it will only grab the space where the letter is and leave the empty block on the right side alone.

If you have a spritesheet of a font and every character has nearly the same width you can also set every character to the same width.
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Post » Thu Sep 29, 2016 6:09 pm

@andreyin - ahh that makes sense. I'll give it a shot - thanks!
B
41
S
12
G
1
Posts: 540
Reputation: 4,188


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests