core/glyph: copy data when adding glyph to cache

fixes #1500