Skip to content

Sharper-Dev/BMFont2Lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BMFont2Lua

Made with LuaRT | TSerial by Taehl

What is BMFont2Lua?

BMFont2Lua is a tool that converts BMFont JSON data to a Lua table and reorganizes the character info array from index-based to id-based, simplifying how character info is accessed.

When you just convert a BMFont JSON, the output Lua table will just contain the character info array in index-based format.

Index-based Array

The problem is: how can you access the character info by id when the array is in index-based format?

It is possible, but you will need to loop through the entire array to find the character info by id.

To solve this, BMFont2Lua reorganizes the character info array to id-based format, making it easier to access character info by id.

Id-based Array

So instead of looping through the entire array to find the character info by id, you can simply use the id as the index to access the character info directly:

local charWidth = fontTable.chars[32].width

How to Use

  1. Open the application and you will see the main window.

Software Window

  1. Click the "..." button to open a file dialog and select a BMFont file (JSON or .fnt with JSON content). If the output path is empty, the output path will be automatically set to the same directory as the input file.

BMFont Dialog

  1. If you want to minify the output Lua table, check the "Minify" checkbox. It will remove all whitespace and line breaks from the output.

Minify Option

  1. Click the "Convert" button to convert the BMFont file to a Lua table. You should see this message when the conversion is complete:

Conversion Complete

So, that's all.

About

Converts BMFont JSON data to a Lua table and reorganizes the character info array from index-based to id-based.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages