Determining Spritefont Character Width

0 favourites
  • 5 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • 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.

  • 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.

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

    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.

  • andreyin - ahh that makes sense. I'll give it a shot - thanks!

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