From dfa058a961dceaaff78fef66e102aae942cfa093 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 2 Dec 2023 22:50:55 +0900 Subject: [PATCH] text/v2: change the signature of NewMultiFace Updates #2845 --- examples/mixedfont/main.go | 2 +- text/v2/multi.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/mixedfont/main.go b/examples/mixedfont/main.go index f50ce6c52..d54c3e9c0 100644 --- a/examples/mixedfont/main.go +++ b/examples/mixedfont/main.go @@ -74,7 +74,7 @@ func (g *Game) Update() error { Size: 32, } - g.face = text.NewMultiFace([]text.Face{en, ja}) + g.face = text.NewMultiFace(en, ja) } return nil } diff --git a/text/v2/multi.go b/text/v2/multi.go index e38bbf439..a44169fdb 100644 --- a/text/v2/multi.go +++ b/text/v2/multi.go @@ -31,11 +31,10 @@ type MultiFace struct { } // NewMultiFace creates a new MultiFace from the given faces. -func NewMultiFace(faces []Face) *MultiFace { - m := &MultiFace{} - m.faces = make([]Face, len(faces)) - copy(m.faces, faces) - return m +func NewMultiFace(faces ...Face) *MultiFace { + return &MultiFace{ + faces: faces, + } } // Metrics implements Face.