Parsing a Truetype font

I tried anything to avoid to read TrueType files. This is a very compact format with cryptic tables. Furthermore, even when we get the glyphs, we will have to deal with quadratic curves.

But we have seen that both text based fonts PostScript Type 3 and SVG have show stopping limits.

We will try here to read TrueType files and get the metrics and the glyphs in a format we can deploy it in our workflow.

Fortunately, we are not the first ones to do this. We will use two sources:

If computers can read file formats, they cannot be too complicated.

We need first a class to read all binary datatypes. There are many

Javascript Editor

We try it out to read the header. We ignore values we do not need.

Javascript Editor

Seems to work, so we continue to read

Javascript Editor

Now lets move to the glyphs table

Javascript Editor

We are close. Can now try to create PostScript code from it

Javascript Editor

showttf connects all points on curve. It does not yet handle the control points and not handle characters using multiple subpaths. But this sounds promising. We will get there in the next chapter

Javascript Editor

My Journey to PostScript