Home

Awesome

Bitmap font generator for msdf-gdx

This is a small utility used to create SDF, MSDF and MSDFA bitmap font files from .ttf files. The generated .fnt files uses libGDX's format.

Here's what you need to download:

Place them both in the same directory.

Usage

The jar file can be run with:

java -jar msdfgen.jar [options] <font-file>

You can also use a configuration file config.txt with:

java -jar msdfgen.jar @config.txt 

The CLI expects at least one parameter specifying the .ttf font file, but there can be more than one.

Options

Examples

java -jar msdfgen.jar -o output -t msdf -a sdf -s 42 -r 6 -c latin-9 font.ttf

Generate MSDF font files with SDF encoded in the alpha layer for input file font.ttf. Font size is 42px and distance range is 6px. Charset is built-in latin-9. The following image is created in the output/ directory:

<img src="examples/roboto-msdfa.png" alt="MSDFA texture atlas"/><br>


java -jar msdfgen.jar -t msdf -a none -s 24 -r 4 -c charset.txt font1.ttf font2.ttf

Generate MSDF font files with no alpha layer for input files font1.ttf and font2.ttf. Font size is 24px and distance range is 4px. Charset is taken from the charset.txt file. The following images are created in the output/ directory:

<img src="examples/roboto-bold-msdf.png" alt="MSDF texture atlas"/> <img src="examples/satisfy-msdf.png" alt="MSDF texture atlas"/>

Changelog

See changelog.

License

All code is licensed under Apache License, Version 2.0.

Contributing

Don't hesitate to open a pull request if you feel like something needs an improvement. Just be sure to follow existing code style.