From 7672c08f46a2d8b6555fa1fd3ca90dd2eb8374d1 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 13 Oct 2019 18:29:39 +0200 Subject: [PATCH] example: update gio version Signed-off-by: Elias Naur --- example/go.mod | 3 +-- example/go.sum | 4 ++-- example/gophers/ui.go | 18 +++--------------- example/hello/hello.go | 10 ++-------- example/kitchen/kitchen.go | 13 ++----------- 5 files changed, 10 insertions(+), 38 deletions(-) diff --git a/example/go.mod b/example/go.mod index 9eb71d50..5b118072 100644 --- a/example/go.mod +++ b/example/go.mod @@ -3,9 +3,8 @@ module gioui.org/example go 1.13 require ( - gioui.org v0.0.0-20191012123625-abb99eca5c54 + gioui.org v0.0.0-20191013162339-8cd4c2e5de65 github.com/google/go-github/v24 v24.0.1 golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3 - golang.org/x/image v0.0.0-20190802002840-cff245a6509b golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 ) diff --git a/example/go.sum b/example/go.sum index 2b4600f6..1015b17d 100644 --- a/example/go.sum +++ b/example/go.sum @@ -1,7 +1,7 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -gioui.org v0.0.0-20191012123625-abb99eca5c54 h1:1LQMwF6UgHRaAbwvoaKWmnv5LwKt2HyXJooDvkNkmRg= -gioui.org v0.0.0-20191012123625-abb99eca5c54/go.mod h1:KqFFi2Dq5gYA3FJ0sDOt8OBXoMsuxMtE8v2f0JExXAY= +gioui.org v0.0.0-20191013162339-8cd4c2e5de65 h1:94lyVLRIPhu95x3goGooL3ZxkDZgo9dRgR6Unecwre0= +gioui.org v0.0.0-20191013162339-8cd4c2e5de65/go.mod h1:KqFFi2Dq5gYA3FJ0sDOt8OBXoMsuxMtE8v2f0JExXAY= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= diff --git a/example/gophers/ui.go b/example/gophers/ui.go index 31579742..1d3166c8 100644 --- a/example/gophers/ui.go +++ b/example/gophers/ui.go @@ -17,6 +17,7 @@ import ( _ "net/http/pprof" "gioui.org/f32" + _ "gioui.org/font/gofont" "gioui.org/gesture" "gioui.org/io/key" "gioui.org/io/pointer" @@ -25,16 +26,11 @@ import ( "gioui.org/op" "gioui.org/op/paint" "gioui.org/text" - "gioui.org/text/opentype" "gioui.org/unit" "gioui.org/widget" "gioui.org/widget/material" "github.com/google/go-github/v24/github" - "golang.org/x/image/font/gofont/gobold" - "golang.org/x/image/font/gofont/goitalic" - "golang.org/x/image/font/gofont/gomono" - "golang.org/x/image/font/gofont/goregular" "golang.org/x/exp/shiny/materialdesign/icons" ) @@ -68,18 +64,10 @@ type user struct { avatar image.Image } -var shaper *text.Shaper - var theme *material.Theme func init() { - s := new(text.Shaper) - s.Register(text.Font{}, opentype.Must(opentype.Parse(goregular.TTF))) - s.Register(text.Font{Style: text.Italic}, opentype.Must(opentype.Parse(goitalic.TTF))) - s.Register(text.Font{Weight: text.Bold}, opentype.Must(opentype.Parse(gobold.TTF))) - s.Register(text.Font{Typeface: "mono"}, opentype.Must(opentype.Parse(gomono.TTF))) - shaper = s - theme = material.NewTheme(s) + theme = material.NewTheme() theme.Color.Text = rgb(0x333333) theme.Color.Hint = rgb(0xbbbbbb) } @@ -136,7 +124,7 @@ func (u *UI) layoutTimings(gtx *layout.Context) { layout.Inset{Top: unit.Dp(16)}.Layout(gtx, func() { txt := fmt.Sprintf("m: %d %s", mallocs, u.profile.Timings) lbl := theme.Caption(txt) - lbl.Font.Typeface = "mono" + lbl.Font.Variant = "Mono" lbl.Layout(gtx) }) }) diff --git a/example/hello/hello.go b/example/hello/hello.go index f14d4f45..4a6dcae0 100644 --- a/example/hello/hello.go +++ b/example/hello/hello.go @@ -9,12 +9,10 @@ import ( "log" "gioui.org/app" + _ "gioui.org/font/gofont" "gioui.org/layout" "gioui.org/text" - "gioui.org/text/opentype" "gioui.org/widget/material" - - "golang.org/x/image/font/gofont/goregular" ) func main() { @@ -28,11 +26,7 @@ func main() { } func loop(w *app.Window) error { - shaper := new(text.Shaper) - shaper.Register(text.Font{}, opentype.Must( - opentype.Parse(goregular.TTF), - )) - th := material.NewTheme(shaper) + th := material.NewTheme() gtx := &layout.Context{ Queue: w.Queue(), } diff --git a/example/kitchen/kitchen.go b/example/kitchen/kitchen.go index 9953e655..bca611f9 100644 --- a/example/kitchen/kitchen.go +++ b/example/kitchen/kitchen.go @@ -10,14 +10,12 @@ import ( "gioui.org/app" "gioui.org/layout" "gioui.org/text" - "gioui.org/text/opentype" "gioui.org/unit" "gioui.org/widget" "gioui.org/widget/material" + _ "gioui.org/font/gofont" "golang.org/x/exp/shiny/materialdesign/icons" - "golang.org/x/image/font/gofont/goitalic" - "golang.org/x/image/font/gofont/goregular" ) func main() { @@ -36,14 +34,7 @@ func main() { } func loop(w *app.Window) error { - shaper := new(text.Shaper) - shaper.Register(text.Font{}, opentype.Must( - opentype.Parse(goregular.TTF), - )) - shaper.Register(text.Font{Style: text.Italic}, opentype.Must( - opentype.Parse(goitalic.TTF), - )) - th := material.NewTheme(shaper) + th := material.NewTheme() gtx := &layout.Context{ Queue: w.Queue(), }