Problem setup "Spacing data" on sprite font

0 favourites
  • 5 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • I've created my own custom font, but I'm having trouble setting the spacing for each character.

    This is my current situation:

    Checking the various sprite font properties in the manual, I found the "Spacing data" property that I thought was right up my alley.

    So I set the "Spacing data" field of my project by inserting a JSON that would indicate the width values of each character.

    Below I leave you the JSON that I wrote (upper and lower case letters are represented by the same character and therefore have the same width):

    [[20,"Ii"],[32,"EeFfLl"],[36,"AaCcDdHhJjKkNnOoPpQqRrSsTtUuVvXxYyZz"],[38,"BbGg"],[52,"MmWw"]]

    The problem is that as you can see from the first image I posted, the whole thing doesn't seem to work properly. The problem is most visible with the letter "i".

    I double-checked the pixel width of each letter I entered in the JSON, and I'm 100% sure I entered them correctly.

    The sprite I used for the font has cells of size 52x66 (as indicated in the font sprite properties), and all the letters are centered within their own cell. Also, the "Character set" property is set with the correct sequence of characters.

    Can anyone tell me where I'm going wrong?

    Tagged:

  • Most people use this tool to make spritefonts:

    construct.net/en/forum/game-development/tools-and-resources-27/sprite-font-generator-v3-64038

    It will generate spacing data for you.

    Even if you prefer the spritefont you made yourself, you can try recreating the same font with that tool and compare the spacing data string to see where you made a mistake.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • does it also affect capital i ?

  • The letters need to be left-justified, not centered.

  • The letters need to be left-justified, not centered.

    That's right.

    Unfortunately, I had missed this part of the manual, and was wrong about leaving the characters centered to their own cell.

    Below is part of the text from the manual, so that it may help in case someone has the same problem as me:

    Individual characters can be displayed with a different width using Spacing data or the Set character width action. In this case, the character should be drawn left-aligned within its cell.

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