TTF -> BDF -> FNT batch UTF8 font conversion utility for Playdate by @HunterBridges
This is a utility to help convert UTF8 TTF fonts into the Playdate proprietary FNT format.
First, you need to install these dependencies:
- Python 3
pip install bdfparser
pip install pillow
pip install pypng
Then you need to build the submodules/otf2bdf
submodule from source.
This utility uses a custom fork which permits conversion using the
raw bitmap strike data in the font.
cd
to the repo root directory and run python3 font_convert.py
The script scans all TTF files in the ttf
directory, and attempts
the conversion process for each found TTF file.
Then, it converts the TTF to BDF with otf2bdf
, using the first
available bitmap strike in each TTF.
From there, the script uses bdfparser to open the BDF font, and
renders out a PNG of all glyphs via Pillow. A copy of the PNG
is saved in the png/
folder for verification. (Users may wish
to modify the script at this point to filter the character set
down based on a strings file)
Finally, the script writes out the FNT in the fnt/
folder. The
PNG data is embedded into the FNT's data=
section.
This utility comes bundled with several fonts from the JFDotFont and KHDotFont open font sets.
Processed FNT files from these sets can be found in the fnt/
folder.
Font specimens can be previewed on their respective pages, or in the png/
folder
of this repository.
- Thanks to @gingerbeardman for pointing to the original set of resources in this thread
- Information about the FNT format specification from jaames/playdate-reverse-engineering
- Acknowledgements and license information for the JFDotFont
set can be found in
acknowledgements/jfdotfont
- Acknowledgements and license information for the KHDotFont
set can be found in
acknowledgements/khdotfont