From c4cb9637f5c85d03aa162968f0dfec3c193fc9dc Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 20 Jan 2023 03:18:06 +0100 Subject: intermediate commit Implement actions and multiple ui widgets --- go/ui/font.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 go/ui/font.go (limited to 'go/ui/font.go') diff --git a/go/ui/font.go b/go/ui/font.go new file mode 100644 index 00000000..065ac0d8 --- /dev/null +++ b/go/ui/font.go @@ -0,0 +1,24 @@ +package ui + +import ( + "log" + + "golang.org/x/image/font" + "golang.org/x/image/font/gofont/goregular" + "golang.org/x/image/font/opentype" +) + +var Font font.Face + +func InitFont() { + tt, err := opentype.Parse(goregular.TTF) + if err != nil { + log.Fatal(err) + } + + opts := &opentype.FaceOptions{Size: 24, DPI: 72} + Font, err = opentype.NewFace(tt, opts) + if err != nil { + log.Fatal(err) + } +} -- cgit v1.2.3