diff --git a/text/v2/glyph.go b/text/v2/glyph.go index 776a41741..b5c956905 100644 --- a/text/v2/glyph.go +++ b/text/v2/glyph.go @@ -50,6 +50,8 @@ type glyphImageCacheKey struct { xoffset fixed.Int26_6 yoffset fixed.Int26_6 + + variations string } type glyphImageCacheEntry struct { diff --git a/text/v2/gotext.go b/text/v2/gotext.go index e4af4c32a..c99bc8dff 100644 --- a/text/v2/gotext.go +++ b/text/v2/gotext.go @@ -338,9 +338,10 @@ func (g *GoTextFace) glyphImage(glyph glyph, origin fixed.Point26_6) (*ebiten.Im Y: (origin.Y + b.Min.Y) & ((1 << 6) - 1), } key := glyphImageCacheKey{ - id: uint32(glyph.shapingGlyph.GlyphID), - xoffset: subpixelOffset.X, - yoffset: subpixelOffset.Y, + id: uint32(glyph.shapingGlyph.GlyphID), + xoffset: subpixelOffset.X, + yoffset: subpixelOffset.Y, + variations: g.ensureVariationsString(), } img := theGlyphImageCache.getOrCreate(g, key, func() *ebiten.Image { return segmentsToImage(glyph.scaledSegments, subpixelOffset, b)