Added some glyph caching to improve performance slightly.