2d1995c62b592adc3c73e734b1ef0607a2eac847 — Elias Naur a month ago 49bb9ab
cmd/scatter: update gio to explicit text sizes

Signed-off-by: Elias Naur <mail@eliasnaur.com>
3 files changed, 25 insertions(+), 21 deletions(-)

M cmd/scatter/ui.go
M go.mod
M go.sum
M cmd/scatter/ui.go => cmd/scatter/ui.go +22 -18
@@ 279,7 279,7 @@ func (a *App) run() error {
 				}
 			case app.UpdateEvent:
 				gtx.Reset(&e.Config, e.Size)
-				a.env.faces.Reset(gtx)
+				a.env.faces.Reset()
 				a.env.insets = layout.Inset{
 					Top:    e.Insets.Top,
 					Left:   e.Insets.Left,


@@ 455,7 455,7 @@ func (a *App) layoutTimings(gtx *layout.Context) {
 		in.Top = unit.Max(gtx, unit.Dp(16), in.Top)
 		in.Layout(gtx, func() {
 			txt := fmt.Sprintf("m: %d %s", mallocs, a.profile.Timings)
-			text.Label{Material: theme.text, Face: a.env.faces.For(fonts.mono, unit.Sp(10)), Text: txt}.Layout(gtx)
+			text.Label{Material: theme.text, Face: a.env.faces.For(fonts.mono), Size: unit.Sp(10), Text: txt}.Layout(gtx)
 		})
 	})
 }


@@ 467,7 467,8 @@ func newContactsPage(env *Env) *contactsPage {
 			Axis: layout.Vertical,
 		},
 		searchEdit: &text.Editor{
-			Face:         env.faces.For(fonts.regular, unit.Sp(20)),
+			Face:         env.faces.For(fonts.regular),
+			Size:         unit.Sp(20),
 			SingleLine:   true,
 			Submit:       true,
 			Hint:         "Email address",


@@ 584,7 585,7 @@ func (p *contactsPage) contact(gtx *layout.Context, index int) {
 			})
 		})
 		c2 := f.Flexible(1, func() {
-			text.Label{Material: theme.text, Face: p.env.faces.For(fonts.regular, unit.Sp(18)), Text: contact.Address}.Layout(gtx)
+			text.Label{Material: theme.text, Face: p.env.faces.For(fonts.regular), Size: unit.Sp(18), Text: contact.Address}.Layout(gtx)
 		})
 
 		f.Layout(c1, c2)


@@ 659,7 660,8 @@ func newSignInPage(env *Env) *signInPage {
 	for _, f := range p.fields {
 		f.env = p.env
 		f.edit = &text.Editor{
-			Face:         env.faces.For(fonts.regular, unit.Sp(16)),
+			Face:         env.faces.For(fonts.regular),
+			Size:         unit.Sp(16),
 			SingleLine:   true,
 			Hint:         f.Hint,
 			Material:     theme.text,


@@ 690,7 692,7 @@ func (p *signInPage) Layout(gtx *layout.Context) {
 	c1 := f.Rigid(func() {
 		var t Topbar
 		t.Layout(gtx, p.env.insets, func() {
-			text.Label{Material: colorMaterial(gtx.Ops, rgb(0xffffff)), Face: p.env.faces.For(fonts.regular, unit.Sp(20)), Text: "Sign in"}.Layout(gtx)
+			text.Label{Material: colorMaterial(gtx.Ops, rgb(0xffffff)), Face: p.env.faces.For(fonts.regular), Size: unit.Sp(20), Text: "Sign in"}.Layout(gtx)
 		})
 	})
 


@@ 732,7 734,7 @@ func (f *formField) Layout(gtx *layout.Context) {
 	theme.text.Add(gtx.Ops)
 	fl := (&layout.Flex{Axis: layout.Vertical}).Init(gtx)
 
-	header := text.Label{Material: theme.text, Text: f.Header, Face: f.env.faces.For(fonts.bold, unit.Sp(12))}
+	header := text.Label{Material: theme.text, Text: f.Header, Face: f.env.faces.For(fonts.bold), Size: unit.Sp(12)}
 	c1 := fl.Rigid(func() {
 		gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
 		header.Layout(gtx)


@@ 769,7 771,7 @@ func (b *Button) Layout(gtx *layout.Context, env *Env) {
 		Inset:    layout.UniformInset(unit.Dp(8)),
 	}
 	bg.Layout(gtx, func() {
-		lbl := text.Label{Material: theme.white, Face: env.faces.For(fonts.regular, unit.Sp(16)), Text: b.Label, Alignment: text.Middle}
+		lbl := text.Label{Material: theme.white, Face: env.faces.For(fonts.regular), Size: unit.Sp(16), Text: b.Label, Alignment: text.Middle}
 		lbl.Layout(gtx)
 	})
 	pointer.RectAreaOp{Rect: image.Rectangle{Max: gtx.Dimensions.Size}}.Add(gtx.Ops)


@@ 878,7 880,7 @@ func (p *threadsPage) Layout(gtx *layout.Context) {
 		c1 := f.Rigid(func() {
 			var t Topbar
 			t.Layout(gtx, p.env.insets, func() {
-				text.Label{Material: theme.white, Face: p.env.faces.For(fonts.regular, unit.Sp(20)), Text: p.account.User}.Layout(gtx)
+				text.Label{Material: theme.white, Face: p.env.faces.For(fonts.regular), Size: unit.Sp(20), Text: p.account.User}.Layout(gtx)
 			})
 		})
 


@@ 973,8 975,8 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
 									initial = string(unicode.ToUpper(c))
 									break
 								}
-								face := p.env.faces.For(fonts.regular, unit.Sp(24))
-								text.Label{Material: theme.white, Face: face, Text: initial}.Layout(gtx)
+								face := p.env.faces.For(fonts.regular)
+								text.Label{Material: theme.white, Face: face, Size: unit.Sp(24), Text: initial}.Layout(gtx)
 							})
 							st.Layout(c1, c2)
 						})


@@ 987,7 989,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
 						f := baseline()
 						f.Init(gtx)
 						c1 := f.Rigid(func() {
-							text.Label{Material: theme.text, Face: p.env.faces.For(font, unit.Sp(18)), Text: t.ID}.Layout(gtx)
+							text.Label{Material: theme.text, Face: p.env.faces.For(font), Size: unit.Sp(18), Text: t.ID}.Layout(gtx)
 						})
 						c2 := f.Flexible(1, func() {
 							gtx.Constraints.Width.Min = gtx.Constraints.Width.Max


@@ 996,7 998,8 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
 								text.Label{
 									Alignment: text.End,
 									Material:  bgtexmat,
-									Face:      p.env.faces.For(font, unit.Sp(12)),
+									Face:      p.env.faces.For(font),
+									Size:      unit.Sp(12),
 									Text:      formatTime(t.Updated),
 								}.Layout(gtx)
 							})


@@ 1006,7 1009,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
 					c2 := f.Rigid(func() {
 						in := layout.Inset{Top: unit.Dp(6)}
 						in.Layout(gtx, func() {
-							text.Label{Material: bgtexmat, Face: p.env.faces.For(font, unit.Sp(14)), MaxLines: 1, Text: t.Snippet}.Layout(gtx)
+							text.Label{Material: bgtexmat, Face: p.env.faces.For(font), Size: unit.Sp(14), MaxLines: 1, Text: t.Snippet}.Layout(gtx)
 						})
 					})
 					f.Layout(c1, c2)


@@ 1032,7 1035,8 @@ func newThreadPage(env *Env, threadID string) *threadPage {
 		},
 		result: make(chan []*Message, 1),
 		msgEdit: &text.Editor{
-			Face:         env.faces.For(fonts.regular, unit.Sp(14)),
+			Face:         env.faces.For(fonts.regular),
+			Size:         unit.Sp(14),
 			Submit:       true,
 			Hint:         "Send a message",
 			Material:     theme.text,


@@ 1113,7 1117,7 @@ func (p *threadPage) Layout(gtx *layout.Context) {
 	f.Init(gtx)
 	c1 := f.Rigid(func() {
 		p.topbar.Layout(gtx, p.env.insets, func() {
-			text.Label{Material: theme.white, Face: p.env.faces.For(fonts.regular, unit.Sp(20)), Text: p.thread.ID}.Layout(gtx)
+			text.Label{Material: theme.white, Face: p.env.faces.For(fonts.regular), Size: unit.Sp(20), Text: p.thread.ID}.Layout(gtx)
 		})
 	})
 


@@ 1209,7 1213,7 @@ func (p *threadPage) message(gtx *layout.Context, index int) {
 
 				var msgWidth int
 				c1 := f.Rigid(func() {
-					label := text.Label{Material: msgMat, Face: p.env.faces.For(fonts.regular, unit.Sp(14)), Text: msg.Message}
+					label := text.Label{Material: msgMat, Face: p.env.faces.For(fonts.regular), Size: unit.Sp(14), Text: msg.Message}
 					label.Layout(gtx)
 					gtx.Dimensions.Size.Y += gtx.Px(unit.Dp(4))
 					msgWidth = gtx.Dimensions.Size.X


@@ 1223,7 1227,7 @@ func (p *threadPage) message(gtx *layout.Context, index int) {
 					var children []layout.FlexChild
 					child := f.Rigid(func() {
 						time := formatTime(msg.Time)
-						tlbl := text.Label{Material: colorMaterial(gtx.Ops, timecol), Face: p.env.faces.For(fonts.regular, unit.Sp(10)), Text: time}
+						tlbl := text.Label{Material: colorMaterial(gtx.Ops, timecol), Face: p.env.faces.For(fonts.regular), Size: unit.Sp(10), Text: time}
 						tlbl.Layout(gtx)
 					})
 					children = append(children, child)

M go.mod => go.mod +1 -1
@@ 3,7 3,7 @@ module scatter.im
 go 1.13
 
 require (
-	gioui.org v0.0.0-20191003113538-6dad034b2280
+	gioui.org v0.0.0-20191005093250-404a065a0e03
 	github.com/eliasnaur/libsignal-protocol-go v0.0.0-20190626062856-3295f72b181e
 	github.com/emersion/go-imap v1.0.0-rc.1
 	github.com/emersion/go-imap-idle v0.0.0-20190519112320-2704abd7050e

M go.sum => go.sum +2 -2
@@ 1,5 1,5 @@
-gioui.org v0.0.0-20191003113538-6dad034b2280 h1:a4zN/MoN6+nhPJFeBDQN/5+4H+wkypEWv76QNPChaVM=
-gioui.org v0.0.0-20191003113538-6dad034b2280/go.mod h1:+CEjc9B//HrBfWsQOVxjCyih7HGIj3Pww1xFHVDZyyk=
+gioui.org v0.0.0-20191005093250-404a065a0e03 h1:TB8lM0pzF2mOM/PQ5MVHBmVLeY+l+ziP/K3ItF3nDys=
+gioui.org v0.0.0-20191005093250-404a065a0e03/go.mod h1:+CEjc9B//HrBfWsQOVxjCyih7HGIj3Pww1xFHVDZyyk=
 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
 github.com/RadicalApp/complete v0.0.0-20170329192659-17e6c0ee499b h1:cAULFohNVfNzco0flF4okSPg3s7/tCj+hMIldtYZo4c=
 github.com/RadicalApp/complete v0.0.0-20170329192659-17e6c0ee499b/go.mod h1:zZ3+l0EkpT2ZPnoamPBG50PBUtQrXwwyJ6elQZMmqgk=