HeadlinesBriefing favicon HeadlinesBriefing.com

How I Built a Complete SDF Fonts Guide After 2 Years

Hacker News •
×

In 2024, I began exploring SDF (signed distance field) font rendering while working on a game and map generator project. My initial experiments with msdfgen, stb_truetype, and tiny-sdf libraries produced working code, but I didn't fully understand the underlying concepts. I documented my incomplete findings on my site, which eventually ranked on the first page of search results for "sdf fonts" despite being far from comprehensive.

This unexpected visibility became an opportunity to create something better. I started with an ambitious overview covering multiple SDF libraries, but quickly realized the scope was too large since each library worked differently. I pivoted to focus solely on msdfgen, exploring tradeoffs like atlas size, antialias width, and shader derivatives. I created detailed diagrams using Excalidraw and ran extensive tests comparing different parameters.

After several redesigns, I finally settled on a "concepts" page that explains how SDF works and how to create various visual effects. I moved implementation details to a separate page and abandoned plans for a standalone downloadable project. The process took over a year, but I'm finally satisfied with the result. You can check out the complete guide I built from my original incomplete notes.