blob: 9e016045221d8e4c6dcf55d764026567a9383f3b (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package font
import (
"bytes"
"log"
"golang.org/x/image/font/gofont/goregular"
"github.com/hajimehoshi/ebiten/v2/text/v2"
)
// TODO: use a font that supports our tap symbol
var fontSource *text.GoTextFaceSource
var Font24 *text.GoTextFace
var Font18 *text.GoTextFace
var Font12 *text.GoTextFace
func InitFont() {
fontSource, err := text.NewGoTextFaceSource(bytes.NewReader(goregular.TTF))
if err != nil {
log.Fatal(err)
}
Font24 = &text.GoTextFace{
Source: fontSource,
Size: 24,
}
Font18 = &text.GoTextFace{
Source: fontSource,
Size: 18,
}
Font12 = &text.GoTextFace{
Source: fontSource,
Size: 12,
}
}
|