From e2e2c1a04601f6af60c30407551c5388d0d050d7 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Fri, 8 May 2026 18:31:25 +0300 Subject: [PATCH] text: avoid creating two Face instances This way their cache can be shared. Signed-off-by: Egon Elbre --- text/gotext.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/text/gotext.go b/text/gotext.go index 298f2c62..2f6b083d 100644 --- a/text/gotext.go +++ b/text/gotext.go @@ -270,8 +270,9 @@ func newShaperImpl(systemFonts bool, collection []FontFace) *shaperImpl { // in the order in which they are loaded, with the first face being the default. func (s *shaperImpl) Load(f FontFace) { desc := opentype.FontToDescription(f.Font) - s.fontMap.AddFace(f.Face.Face(), fontscan.Location{File: fmt.Sprint(desc)}, desc) - s.addFace(f.Face.Face(), f.Font) + face := f.Face.Face() + s.fontMap.AddFace(face, fontscan.Location{File: fmt.Sprint(desc)}, desc) + s.addFace(face, f.Font) } func (s *shaperImpl) addFace(f *font.Face, md giofont.Font) {