~eliasnaur/gio-example

613640ec7f3397c696aef438e2ff464416854f95 — Chris Waldon 1 year, 3 months ago c78947f
go.*,bidi,fps-table,gophers,kitchen,markdown,textfeatures: update text usage

This commit updates references to font properties to use the symbols in gioui.org/font
instead of gioui.org/text, handling the breaking change from gioui.org@f77bf9a42.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
8 files changed, 24 insertions(+), 27 deletions(-)

M bidi/bidi.go
M fps-table/table.go
M go.mod
M go.sum
M gophers/ui.go
M kitchen/kitchen.go
M markdown/main.go
M textfeatures/main.go
M bidi/bidi.go => bidi/bidi.go +4 -3
@@ 11,6 11,7 @@ import (
	"os"

	"gioui.org/app"
	"gioui.org/font"
	"gioui.org/io/system"
	"gioui.org/layout"
	"gioui.org/op"


@@ 42,9 43,9 @@ type (
func loop(w *app.Window) error {
	arabicFace, _ := opentype.Parse(nsareg.TTF)
	englishFace, _ := opentype.Parse(robotoregular.TTF)
	collection := []text.FontFace{}
	collection = append(collection, text.FontFace{Font: text.Font{Typeface: "Latin"}, Face: englishFace})
	collection = append(collection, text.FontFace{Font: text.Font{Typeface: "Arabic"}, Face: arabicFace})
	collection := []font.FontFace{}
	collection = append(collection, font.FontFace{Font: font.Font{Typeface: "Latin"}, Face: englishFace})
	collection = append(collection, font.FontFace{Font: font.Font{Typeface: "Arabic"}, Face: arabicFace})
	th := material.NewTheme(collection)
	var ed widget.Editor
	txt := "Hello أهلا my good friend صديقي الجيد bidirectional text نص ثنائي الاتجاه."

M fps-table/table.go => fps-table/table.go +2 -1
@@ 13,6 13,7 @@ import (
	"time"

	"gioui.org/app"
	"gioui.org/font"
	"gioui.org/font/gofont"
	"gioui.org/io/system"
	"gioui.org/layout"


@@ 105,7 106,7 @@ func layoutTable(th *material.Theme, gtx C, timings []FrameTiming, grid *compone

	// Configure a label styled to be a heading.
	headingLabel := material.Body1(th, "")
	headingLabel.Font.Weight = text.Bold
	headingLabel.Font.Weight = font.Bold
	headingLabel.Alignment = text.Middle
	headingLabel.MaxLines = 1


M go.mod => go.mod +3 -3
@@ 4,9 4,9 @@ go 1.18

require (
	eliasnaur.com/font v0.0.0-20230308162249-dd43949cb42d
	gioui.org v0.0.0-20230401135047-e768fe347a73
	gioui.org v0.0.0-20230418224039-a7c9ca99f3be
	gioui.org/cmd v0.0.0-20220818080936-02068d6340fc
	gioui.org/x v0.0.0-20230418115547-b8533313f976
	gioui.org/x v0.0.0-20230419130519-087d853e2397
	github.com/go-gl/gl v0.0.0-20210315015930-ae072cafe09d
	github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210311203641-62640a716d48
	github.com/google/go-github/v24 v24.0.1


@@ 26,7 26,7 @@ require (
	github.com/akavel/rsrc v0.10.1 // indirect
	github.com/esiqveland/notify v0.11.0 // indirect
	github.com/go-ole/go-ole v1.2.6 // indirect
	github.com/go-text/typesetting v0.0.0-20230329143336-a38d00edd832 // indirect
	github.com/go-text/typesetting v0.0.0-20230413204129-b4f0492bf7ae // indirect
	github.com/godbus/dbus/v5 v5.0.6 // indirect
	github.com/golang/protobuf v1.4.2 // indirect
	github.com/google/go-querystring v1.0.0 // indirect

M go.sum => go.sum +7 -7
@@ 1,7 1,7 @@
eliasnaur.com/font v0.0.0-20230308162249-dd43949cb42d h1:ARo7NCVvN2NdhLlJE9xAbKweuI9L6UgfTbYb0YwPacY=
eliasnaur.com/font v0.0.0-20230308162249-dd43949cb42d/go.mod h1:OYVuxibdk9OSLX8vAqydtRPP87PyTFcT9uH3MlEGBQA=
gioui.org v0.0.0-20230401135047-e768fe347a73 h1:07hK27qHktByzic7em44RDYkP+eEVtM4YCUFOyXMoUs=
gioui.org v0.0.0-20230401135047-e768fe347a73/go.mod h1:7nNGoqbKQrlMpF4SGrQWYEMr9MuSXlVTCl2qRkZDsjA=
gioui.org v0.0.0-20230418224039-a7c9ca99f3be h1:TS+39qH1t6THprhFqWz0SedSip2mQ42oA49GFHXFMhc=
gioui.org v0.0.0-20230418224039-a7c9ca99f3be/go.mod h1:8CFQM/4LurRd9G3NUYdacFb9j2pK0LrAyVO2mAZo4mw=
gioui.org/cmd v0.0.0-20220818080936-02068d6340fc h1:KfVMY8YBF6OBlkw2WgCySAilfsyjtPtZaWaBAKSofo8=
gioui.org/cmd v0.0.0-20220818080936-02068d6340fc/go.mod h1:sOPHaz5lc8CQuJqPyX/YTFdcs5+XKNXXa03qxFIln6w=
gioui.org/cpu v0.0.0-20210808092351-bfe733dd3334/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=


@@ 9,8 9,8 @@ gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2 h1:AGDDxsJE1RpcXTAxPG2B4jrwVUJG
gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
gioui.org/shader v1.0.6 h1:cvZmU+eODFR2545X+/8XucgZdTtEjR3QWW6W65b0q5Y=
gioui.org/shader v1.0.6/go.mod h1:mWdiME581d/kV7/iEhLmUgUK5iZ09XR5XpduXzbePVM=
gioui.org/x v0.0.0-20230418115547-b8533313f976 h1:24NbXu/21ngR3euvzuZnXkn/G+mqZMxIkSaneyhuK54=
gioui.org/x v0.0.0-20230418115547-b8533313f976/go.mod h1:kUKv6aaVpK6WPXh47hFXHo2EIAZUoVIG5/a+7N8yNT4=
gioui.org/x v0.0.0-20230419130519-087d853e2397 h1:fbDu3qeytKPqOTQNp21s98+WgiwrcxRmga1XiYL4QR8=
gioui.org/x v0.0.0-20230419130519-087d853e2397/go.mod h1:crfhY/2Au5+xaxXhmZRtZ8ruEMPi1Qiema/UVNxizKM=
git.sr.ht/~jackmordaunt/go-toast v1.0.0 h1:bbRox6VkotdOj3QcWimZQ84APoszIsA/pSIj8ypDdV8=
git.sr.ht/~jackmordaunt/go-toast v1.0.0/go.mod h1:aIuRX/HdBOz7yRS8rOVYQCwJQlFS7DbYBTpUV0SHeeg=
git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0 h1:bGG/g4ypjrCJoSvFrP5hafr9PPB5aw8SjcOWWila7ZI=


@@ 29,9 29,9 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210311203641-62640a716d48 h1:QrUfZrT8n7
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210311203641-62640a716d48/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-text/typesetting v0.0.0-20230329143336-a38d00edd832 h1:yV4rFdcvwZXE0lZZ3EoBWjVysHyVo8DLY8VihDciNN0=
github.com/go-text/typesetting v0.0.0-20230329143336-a38d00edd832/go.mod h1:zvWM81wAVW6QfVDI6yxfbCuoLnobSYTuMsrXU/u11y8=
github.com/go-text/typesetting-utils v0.0.0-20230326210548-458646692de6 h1:zAAA1U4ykFwqPbcj6YDxvq3F2g0wc/ngPfLJjkR/8zs=
github.com/go-text/typesetting v0.0.0-20230413204129-b4f0492bf7ae h1:LCcaQgYrnS+sx9Tc3oGUvbRBRt+5oFnKWakaxeAvNVI=
github.com/go-text/typesetting v0.0.0-20230413204129-b4f0492bf7ae/go.mod h1:KmrpWuSMFcO2yjmyhGpnBGQHSKAoEgMTSSzvLDzCuEA=
github.com/go-text/typesetting-utils v0.0.0-20230412163830-89e4bcfa3ecc h1:9Kf84pnrmmjdRzZIkomfjowmGUhHs20jkrWYw/I6CYc=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=

M gophers/ui.go => gophers/ui.go +2 -2
@@ 11,6 11,7 @@ import (
	"log"
	"runtime"

	"gioui.org/font"
	"gioui.org/font/gofont"
	"gioui.org/gesture"
	"gioui.org/io/key"


@@ 19,7 20,6 @@ import (
	"gioui.org/op"
	"gioui.org/op/clip"
	"gioui.org/op/paint"
	"gioui.org/text"
	"gioui.org/unit"
	"gioui.org/widget"
	"gioui.org/widget/material"


@@ 211,7 211,7 @@ func (u *UI) layoutUsers(gtx layout.Context) {
					return in.Layout(gtx, func(gtx C) D {
						e := material.Editor(theme, u.edit2, "Hint")
						e.TextSize = unit.Sp(14)
						e.Font.Style = text.Italic
						e.Font.Style = font.Italic
						return e.Layout(gtx)
					})
				}),

M kitchen/kitchen.go => kitchen/kitchen.go +2 -2
@@ 19,6 19,7 @@ import (

	"gioui.org/app"
	"gioui.org/f32"
	"gioui.org/font"
	"gioui.org/font/gofont"
	"gioui.org/gpu/headless"
	"gioui.org/io/router"


@@ 27,7 28,6 @@ import (
	"gioui.org/op"
	"gioui.org/op/clip"
	"gioui.org/op/paint"
	"gioui.org/text"
	"gioui.org/unit"
	"gioui.org/widget"
	"gioui.org/widget/material"


@@ 255,7 255,7 @@ func kitchen(gtx layout.Context, th *material.Theme) layout.Dimensions {
		},
		func(gtx C) D {
			e := material.Editor(th, lineEditor, "Hint")
			e.Font.Style = text.Italic
			e.Font.Style = font.Italic
			border := widget.Border{Color: color.NRGBA{A: 0xff}, CornerRadius: unit.Dp(8), Width: unit.Dp(2)}
			return border.Layout(gtx, func(gtx C) D {
				return layout.UniformInset(unit.Dp(8)).Layout(gtx, e.Layout)

M markdown/main.go => markdown/main.go +2 -1
@@ 17,6 17,7 @@ import (
	"os"

	"gioui.org/app"
	"gioui.org/font"
	"gioui.org/io/system"
	"gioui.org/layout"
	"gioui.org/op"


@@ 86,7 87,7 @@ type Theme struct {
}

// NewTheme instantiates a theme, extending material theme.
func NewTheme(font []text.FontFace) *Theme {
func NewTheme(font []font.FontFace) *Theme {
	return &Theme{
		Base: material.NewTheme(font),
	}

M textfeatures/main.go => textfeatures/main.go +2 -8
@@ 14,7 14,6 @@ import (
	"gioui.org/io/system"
	"gioui.org/layout"
	"gioui.org/op"
	"gioui.org/text"
	"gioui.org/widget"
	"gioui.org/widget/material"



@@ 38,16 37,11 @@ func loop(w *app.Window) error {
	// Load default font collection.
	collection := gofont.Collection()
	// Load a color emoji font.
	face, err := opentype.Parse(colEmoji.TTF)
	faces, err := opentype.ParseCollection(colEmoji.TTF)
	if err != nil {
		panic(err)
	}
	th := material.NewTheme(append(collection, text.FontFace{
		Font: text.Font{
			Typeface: "Noto Color Emoji",
		},
		Face: face,
	}))
	th := material.NewTheme(append(collection, faces...))
	var ops op.Ops
	var sel widget.Selectable
	message := "🥳🧁🍰🎁🎂🎈🎺🎉🎊\n📧〽️🧿🌶️🔋\n😂❤️😍🤣😊\n🥺🙏💕😭😘\n👍😅👏"