diff --git a/domain/dialog.go b/domain/dialog.go index b58935c..adccba5 100644 --- a/domain/dialog.go +++ b/domain/dialog.go @@ -10,6 +10,7 @@ func (d *Domain) InitDialog() { "TestDialog": { Layout: entity.DialogLayout{ ChoiceFont: entity.FontLayout{ + Path: "fonts/Arial.ttf", DPI: 72, Size: 24, Color: color.White, diff --git a/domain/menu.go b/domain/menu.go index 3d74691..5d2e25e 100644 --- a/domain/menu.go +++ b/domain/menu.go @@ -13,6 +13,7 @@ func (d *Domain) InitMenu() { CurrentSelected: 0, Layout: entity.MenuLayout{ MenuItemFont: entity.FontLayout{ + Path: "fonts/Arial.ttf", DPI: 72, Size: 24, Color: color.White, @@ -41,6 +42,7 @@ func (d *Domain) InitMenu() { CurrentSelected: 0, Layout: entity.MenuLayout{ MenuItemFont: entity.FontLayout{ + Path: "fonts/Arial.ttf", DPI: 72, Size: 24, Color: color.White, diff --git a/fonts/Arial.ttf b/fonts/Arial.ttf new file mode 100644 index 0000000..7ff88f2 Binary files /dev/null and b/fonts/Arial.ttf differ diff --git a/konstructor/engine/engine.utils.go b/konstructor/engine/engine.utils.go index 5618fc1..faf6a7c 100644 --- a/konstructor/engine/engine.utils.go +++ b/konstructor/engine/engine.utils.go @@ -10,7 +10,6 @@ import ( _ "image/png" "github.com/hajimehoshi/ebiten" - "github.com/hajimehoshi/ebiten/examples/resources/fonts" "golang.org/x/image/font" "golang.org/x/image/font/opentype" ) @@ -36,7 +35,8 @@ func LoadImage(path string) *ebiten.Image { } func GetFontFace(layout entity.FontLayout) font.Face { - tt, _ := opentype.Parse(fonts.MPlus1pRegular_ttf) + file, _ := ioutil.ReadFile(layout.Path) + tt, _ := opentype.Parse(file) face, _ := opentype.NewFace(tt, &opentype.FaceOptions{ Size: layout.DPI, DPI: layout.Size, diff --git a/konstructor/entity/entity.font.go b/konstructor/entity/entity.font.go index 0895596..02746e7 100644 --- a/konstructor/entity/entity.font.go +++ b/konstructor/entity/entity.font.go @@ -3,6 +3,7 @@ package entity import "image/color" type FontLayout struct { + Path string DPI float64 Size float64 Color color.Color