A small script for converting 4.x tilesets to fonts
Usage:
Create a TileSet resource and load in your font texture as an Atlas.
(This works best if your source font file is a fixed grid.)
Add a Physics Layer and a Custom Data layer with one entry called "character"
, setting its type to String.
You can load multiple font sizes in, each as a seperate atlas, to one TileSet.
Make each character you'd like to put in your font into a tile.
If you want your font to have variable width characters, add a collision polygon to your character.
As of right now, only the second vertex in the first collision shape is used.
(This is for an aesthetics reason so you can see the width of the character in the preview)
Move the second vertex to match the width of the character. You should include spacing if required.
In the custom data layer, set the character field to match the tiles character, or whatever character you want.
This lets you set any unicode character to mean any glyph, allowing for extra tiles for icons and emoji.
Add the FontCreator script to a node in your scene tree. Load in the TileSet into the Tiles property. Set the path you want to save the font to, or select a Resource to override it with.
The FontPage resource contains the values you tweak between eaach font size.
TileSet index is the Atlas ID for this font page
Font Size is the size value you set in your Theme to access this font page.
Make it match your Fixed Size unless you're doing something funky.
Fixed Size is the actual Glyph Size in terms of its space in the font image.
Ascent and Descent are kinda hard to understand values, they set the vertical height and distance between each new line.
Height is for Vertical fonts, just set it to match your Fixed Size if you're making a normal horizontal font.
Once you're done with your options, Run the scene that contains the node with the FontCreator script on it, and it will do its process.