move GetFontFace into FontLayout struct

This commit is contained in:
2023-07-05 22:55:37 +02:00
parent 607cf0d44f
commit 41a32a8fe5
4 changed files with 20 additions and 17 deletions

View File

@@ -2,7 +2,6 @@ package engine
import (
"bytes"
"game/konstructor/entity"
"image"
"io/ioutil"
"log"
@@ -10,8 +9,6 @@ import (
_ "image/png"
"github.com/hajimehoshi/ebiten"
"golang.org/x/image/font"
"golang.org/x/image/font/opentype"
)
func LoadImage(path string) *ebiten.Image {
@@ -33,14 +30,3 @@ func LoadImage(path string) *ebiten.Image {
return out
}
func GetFontFace(layout entity.FontLayout) font.Face {
file, _ := ioutil.ReadFile(layout.Path)
tt, _ := opentype.Parse(file)
face, _ := opentype.NewFace(tt, &opentype.FaceOptions{
Size: layout.DPI,
DPI: layout.Size,
Hinting: font.HintingVertical,
})
return face
}