Sprite size

Just like Font Assets have Face Info which define key metrics of a font, I added something similar to Sprite Assets as seen below.

Sprite Assets that do not currently have Face Info data, will continue to inherit the metrics of the current font asset that precedes the sprite and thus scaling the sprite accordingly.

Sprite Assets with Face Info will behave independently of whatever font assets just like any other font asset would.

On the left side, you can see how the sprites are affected by the metrics / scale of the font assets. On the right side, you can see how the sprites are unaffected by font assets.

This change will result in Sprite Assets (with defined Face Info) behaving more like font assets.

Since Sprite Assets are created from a texture which doesn’t have metrics like a font does, these Face Info values have to be defined by the user.

As starting point when defining these values a user could use a Point Size in the ballpark of the sprite sizes. In my case, the sprites were all 128 x 128 so I set the Point Size at 128.

The Ascent and Descent Line impact line spacing (again just like it would with font assets).

The Baseline is where the sprite will be drawn taking into account the BearingX and BearingY. Bx and By are offsets relative to the top left corner of the sprite rectangle and where the pivot is located for the given sprite.

Now back to your specific case in regards to the B sprite on the third right line of the pouet, the B was smaller because the linefeed character was coming from the main font asset whereas the space is coming from the fallback which is why adding a space would affect the scale of the sprite. Once you define Face Info for your sprite assets and assuming you normalize your font assets / fallbacks, you should be getting much more consistent / predictable results regardless of what font asset / fallback is used.

1 Like