diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2022-12-27 14:29:39 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:46:38 +0200 |
| commit | d6b5eeaa5e639c5ab89b5e1c93075a1b765794dc (patch) | |
| tree | f87422bb91c2197f88aa8d29092592858764049d /go/font | |
| parent | 3c2ee4ee48480a28dc606878503f314ec8862d45 (diff) | |
| download | muhqs-game-d6b5eeaa5e639c5ab89b5e1c93075a1b765794dc.tar.gz muhqs-game-d6b5eeaa5e639c5ab89b5e1c93075a1b765794dc.zip | |
intermediate commit
Diffstat (limited to 'go/font')
| -rw-r--r-- | go/font/font.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/go/font/font.go b/go/font/font.go new file mode 100644 index 00000000..ae75cf8d --- /dev/null +++ b/go/font/font.go @@ -0,0 +1,38 @@ +package font + +import ( + "log" + + "golang.org/x/image/font" + "golang.org/x/image/font/gofont/goregular" + "golang.org/x/image/font/opentype" +) + +var Font24 font.Face +var Font18 font.Face +var Font12 font.Face + +func InitFont() { + tt, err := opentype.Parse(goregular.TTF) + if err != nil { + log.Fatal(err) + } + + opts := &opentype.FaceOptions{Size: 24, DPI: 72} + Font24, err = opentype.NewFace(tt, opts) + if err != nil { + log.Fatal(err) + } + + opts = &opentype.FaceOptions{Size: 18, DPI: 72} + Font18, err = opentype.NewFace(tt, opts) + if err != nil { + log.Fatal(err) + } + + opts = &opentype.FaceOptions{Size: 12, DPI: 72} + Font12, err = opentype.NewFace(tt, opts) + if err != nil { + log.Fatal(err) + } +} |
