Skip to content

Commit

Permalink
We have to safely clear this cache...
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jan 7, 2025
1 parent 19497f0 commit 23f68e2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/painter/font.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,14 @@ func CachedFontFace(style fyne.TextStyle, source fyne.Resource, o fyne.CanvasObj

// ClearFontCache is used to remove cached fonts in the case that we wish to re-load Font faces
func ClearFontCache() {
fontCache = &sync.Map{}
fontCustomCache = &sync.Map{}
fontCache.Range(func(key, _ any) bool {
fontCache.Delete(key)
return true
})
fontCustomCache.Range(func(key, _ any) bool {
fontCustomCache.Delete(key)
return true
})
}

// DrawString draws a string into an image.
Expand Down

0 comments on commit 23f68e2

Please sign in to comment.