diff --git a/internal/cache/text.go b/internal/cache/text.go index 84381fafac..17f546c2a7 100644 --- a/internal/cache/text.go +++ b/internal/cache/text.go @@ -29,7 +29,8 @@ type fontSizeEntry struct { type FontCacheEntry struct { fontSizeEntry - Color color.Color + Canvas fyne.Canvas + Color color.Color } // GetFontMetrics looks up a calculated size and baseline required for the specified text parameters. diff --git a/internal/painter/gl/texture.go b/internal/painter/gl/texture.go index 79dedf704b..5cfda8beba 100644 --- a/internal/painter/gl/texture.go +++ b/internal/painter/gl/texture.go @@ -38,7 +38,7 @@ func (p *painter) getTexture(object fyne.CanvasObject, creator func(canvasObject if t.FontSource != nil { custom = t.FontSource.Name() } - ent := cache.FontCacheEntry{Color: t.Color} + ent := cache.FontCacheEntry{Color: t.Color, Canvas: p.canvas} ent.Text = t.Text ent.Size = t.TextSize ent.Style = t.TextStyle