Announcing pdfontconv: a web-based conversion tool to Playdate .fnt from TTF, OTF, WOFF, WOFF2

pdfontconv is a browser-based tool that lets you convert any TTF, OTF, WOFF or WOFF2 font into Playdate's .fnt format.

I only found out about tophat after I hacked up pdfontconv, but I'm glad I wrote it anyway: tophat clips glyphs on some fonts (e.g. Permanent Marker) and it doesn't import kerning data.

To make sure that glyphs are never clipped, pdfontconv adds extra padding around each glyph, and then writes a negative tracking value to the .fnt file to compensate. The drawback is a bit of left and right margin on each line of text, as you can see in the example above. Maybe @daniel wants to borrow this hack for tophat :wink:

Browsers don't have an API to access kerning data directly, so pdfontconv just brute-forces it by measuring the width of each possible character pair. I'm not sure how well this works for larger character sets; if it's too slow, I might need to write a font file parser.

I hacked this up in a day, so there might be bugs, and there are definitely usability issues. But I guess most people won't need to use it for more than a few minutes, so it'll do for now.

>> LAUNCH PDFONTCONV <<

11 Likes