Skip to content

TTF -> BDF -> FNT batch font conversion utility for Playdate

License

Notifications You must be signed in to change notification settings

hunterbridges/PDFontConvert

Repository files navigation

PDFontConvert

TTF -> BDF -> FNT batch UTF8 font conversion utility for Playdate by @HunterBridges

Overview

This is a utility to help convert UTF8 TTF fonts into the Playdate proprietary FNT format.

Requirements

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.

How to use

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.

Bundled Fonts

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.

Acknowledgements

About

TTF -> BDF -> FNT batch font conversion utility for Playdate

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages