aboutsummaryrefslogtreecommitdiff
path: root/go/ui/font.go
blob: 065ac0d8dfd069141739b200cc701715f52c85a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
	}
}