WIP: port to cpp, first pass of context and glyph is complete.