TTF Font Rendering

TTF Font Rendering

While developing software I chose to develop methods to render true-type fonts (TTF) directly for my applications. The methods pursued are detailed in this section.

Originally intended for a web application, I attempted to triangulate the font glyphs and render the triangles. The triangles were maintained in a JSON file that would be rendered using External link Three.js. Due to issues, especially related to size of downloads, and pivoting to a C++ application, this approach was discontinued. Details of this method are presented in TTF Font Triangulation in the side-bar.

Once development of the web-application had been replaced by a C++ version, font rendering was reworked. With the desire to make the application very simple and require very few libraries, I attempted to render font glyphs directly using a shader. I was able to read a font file and render the glyphs in my application. Details of this approach can be seen in Quadratic Shader in the side-bar.

While I could render the glyphs, there is much more to rendering text than just the raw graphics. I chose to discontinue creation of my own font rendering when it became apparent to me the depth of the rabbit-hole I was navigating. There are many libraries that already traverse this territory (internationalization) and it was not what I wanted to be spending my time on. I decided the pragmatic solution was to leverage the work of others and pivot.

My font rendering has been replaced by freely available third party methods, particularly a font atlas approach featured in External link Nuklear. Having sidelined my own work, it may need revisited during internationalization, if attempted, but even then the intent is not to roll my own solution.

C++ 20 Modules Glyph Triangulation