Font Parser and Renderer
Font Parser and Renderer
Over the summer I first watched sebastian lague's video on font rendering and wanted to give it a go myself. I had some previous experience with parsing files but I had never forayed into binary parsing before. To understand how it works, you need to understand the OpenType format.
OpenType Overview
The OpenType format, one of many ways fonts are distributed, is a binary format that is made of multiple tables. The most important tables are the cmap
table, which maps character codes to glyph indices, and the glyf
table, which contains the actual glyph data. The head
, hhea
, and maxp
tables provide metadata about the font. The head
table is especially relevant as it contains the offsets to the other tables, allowing us to navigate the font file.