text: make Shaper an interface

And rename out the caching implementation to FontRegistry.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-01-13 14:48:31 +01:00
parent 3f6a1c34d3
commit e25b1639b9
9 changed files with 27 additions and 20 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ func (l *lineIterator) Next() (text.String, f32.Point, bool) {
return text.String{}, f32.Point{}, false
}
func (l Label) Layout(gtx *layout.Context, s *text.Shaper, font text.Font, txt string) {
func (l Label) Layout(gtx *layout.Context, s text.Shaper, font text.Font, txt string) {
cs := gtx.Constraints
textLayout := s.Layout(gtx, font, txt, text.LayoutOptions{MaxWidth: cs.Width.Max})
lines := textLayout.Lines