go.*,text: update go-text to pick up font transformation caching

This commit picks up improvements in upstream go-text that (among other things)
allow the shaper to reuse a lot of information when shaping the same font face
multiple times (using an LRU cache to keep that information available). I've
tried to pick a reasonable default LRU size of 32 faces.

My simple benchmarks indicate a definitive performance gain and reduction in
memory use across the board, which is especially noticable for complex fonts
like arabic and emoji.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2023-04-05 12:26:06 -04:00
committed by Elias Naur
parent 73787b8478
commit 6937a5dd1f
3 changed files with 4 additions and 3 deletions
+1
View File
@@ -200,6 +200,7 @@ func NewShaper(collection []FontFace) *Shaper {
for _, f := range collection {
l.shaper.Load(f)
}
l.shaper.shaper.SetFontCacheSize(32)
return l
}