A simple command-line tool to generate GameMaker 2.3+ compatible bitmap fonts
- Ensure that Node.js is installed by using the
node -v
command in any terminal, otherwise install Node.js - Download BMFont and extract both
bmfont64.com
andbmfont64.exe
to thedepend/
folder - (OPTIONAL) Open BMFont and modify the
gm23.bmfc
file to your liking, though this should already be setup for GameMaker compatibility - Donate and download BMFont to GameMaker converter from YellowAfterlife and extract the following files to the
depend/
folder:neko.dll
gcmt-dll.dll
std.ndll
regexp.ndll
BmFontToYY23.n
BmFontToYY23.exe
- Create an
input.json
file in the root directory, seeinput_template.json
contains a barebores layout of the file - Modify
input.json
to your heart's content - Open a terminal in the root and run
node main.js -input input.json
- Watch the output, once the program has finished a "Exported X fonts in Xms" message will be displayed
- Check the
export/
folder forexport.yyp
and respective folders inside ofexport/fonts/
for each of your fonts. - Modify any
.png
files prior to importing into your project. - Open
export.yyp
and selectTools > Create Local Package
to create a local package containing the newly generated fonts - Open your GameMaker project and select
Tools > Import Local Package
to import your fonts - Voila! The font should be usable in your project now.
Below is a commented variation of the input.json
file with every possible field
{
// Optional
"Configuration": {
// The file to inherit settings from for BMFont, defaults to "depend/gm23.bmfc" if not provided
"File": "depend/gm23.bmfc",
// An optional prefix to prepend to exported font assets names, defaults to "fnt" if not provided
"Prefix": "fnt",
// An optional postfix to append to exported font asset names, blank/not used if not provided
"Postfix": "_Exported",
// The size of texture pages generated by BMFont, width and height must be equal and a power of two, defaults to 1024x1024 if not provided
"Size": {
"Width": 2048,
"Height": 2048
},
// Amount to scale font sizes by, defaults to 1 if not provided.
// 2 is selected here as it's most similar to Paint.net's font sizing
"Scale": 2
},
// Required
"Fonts": [
// You can provide a list of fonts in this field
{
// The name of the exported asset, so for example with the above settings our fonts would export as
// fntLarge_Exported
"File": "Large",
// The name of the font on your system, this can include spaces. If you're unsure about a font name, you can use BMFont to select the font
// and then copy that into this field
"Name": "Arial",
// The size of the font you want to export, this is scaled by Configuration.Scale
// Measured in pixels
"Size": 96,
// The character range to export from the font, defaults to 32-126 if not provided
"Range": [32, 126],
// The amount of padding to use for the font, defaults to {L: 2, R: 2, U: 0, D: 2} if not provided
"Padding": {
"Left": 4,
"Right": 4,
"Up": 2,
"Down": 8
},
// The types of styling to apply to the font, can be "none", "bold", or "italic", defaults to "none" if not provided
"Style": [
"bold",
"italic"
]
},
{
"File": "Medium",
"Name": "Arial",
"Size": 48
}
]
}