diff options
Diffstat (limited to 'go/ui/font.go')
| -rw-r--r-- | go/ui/font.go | 24 |
1 files changed, 24 insertions, 0 deletions
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) + } +} |
