From 8352be9369077597ce5f442ee655dfd41eb4a9fc Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 16 Nov 2023 12:07:11 +0900 Subject: [PATCH] text/v2: increase the soft limit of the glyph cache if the face is small Updates #2843 --- text/v2/glyph.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/v2/glyph.go b/text/v2/glyph.go index 611da7592..776a41741 100644 --- a/text/v2/glyph.go +++ b/text/v2/glyph.go @@ -101,7 +101,7 @@ func (g *glyphImageCache) getOrCreate(face Face, key glyphImageCacheKey, create // If the number of glyphs exceeds this soft limits, old glyphs are removed. // Even after cleaning up the cache, the number of glyphs might still exceed the soft limit, but // this is fine. - const cacheSoftLimit = 512 + cacheSoftLimit := 128 * glyphVariationCount(face) if len(g.cache[faceCacheKey]) > cacheSoftLimit { for key, e := range g.cache[faceCacheKey] { // 60 is an arbitrary number.