Refactored glyph rendering code into a new class