Fix export of glyphs to pdf

This brings in a patch by @spakin that broke due to a few large code changes.