add Arial.ttf
This commit is contained in:
@@ -10,6 +10,7 @@ func (d *Domain) InitDialog() {
|
|||||||
"TestDialog": {
|
"TestDialog": {
|
||||||
Layout: entity.DialogLayout{
|
Layout: entity.DialogLayout{
|
||||||
ChoiceFont: entity.FontLayout{
|
ChoiceFont: entity.FontLayout{
|
||||||
|
Path: "fonts/Arial.ttf",
|
||||||
DPI: 72,
|
DPI: 72,
|
||||||
Size: 24,
|
Size: 24,
|
||||||
Color: color.White,
|
Color: color.White,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ func (d *Domain) InitMenu() {
|
|||||||
CurrentSelected: 0,
|
CurrentSelected: 0,
|
||||||
Layout: entity.MenuLayout{
|
Layout: entity.MenuLayout{
|
||||||
MenuItemFont: entity.FontLayout{
|
MenuItemFont: entity.FontLayout{
|
||||||
|
Path: "fonts/Arial.ttf",
|
||||||
DPI: 72,
|
DPI: 72,
|
||||||
Size: 24,
|
Size: 24,
|
||||||
Color: color.White,
|
Color: color.White,
|
||||||
@@ -41,6 +42,7 @@ func (d *Domain) InitMenu() {
|
|||||||
CurrentSelected: 0,
|
CurrentSelected: 0,
|
||||||
Layout: entity.MenuLayout{
|
Layout: entity.MenuLayout{
|
||||||
MenuItemFont: entity.FontLayout{
|
MenuItemFont: entity.FontLayout{
|
||||||
|
Path: "fonts/Arial.ttf",
|
||||||
DPI: 72,
|
DPI: 72,
|
||||||
Size: 24,
|
Size: 24,
|
||||||
Color: color.White,
|
Color: color.White,
|
||||||
|
|||||||
BIN
fonts/Arial.ttf
Normal file
BIN
fonts/Arial.ttf
Normal file
Binary file not shown.
@@ -10,7 +10,6 @@ import (
|
|||||||
_ "image/png"
|
_ "image/png"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
"github.com/hajimehoshi/ebiten/examples/resources/fonts"
|
|
||||||
"golang.org/x/image/font"
|
"golang.org/x/image/font"
|
||||||
"golang.org/x/image/font/opentype"
|
"golang.org/x/image/font/opentype"
|
||||||
)
|
)
|
||||||
@@ -36,7 +35,8 @@ func LoadImage(path string) *ebiten.Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetFontFace(layout entity.FontLayout) font.Face {
|
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{
|
face, _ := opentype.NewFace(tt, &opentype.FaceOptions{
|
||||||
Size: layout.DPI,
|
Size: layout.DPI,
|
||||||
DPI: layout.Size,
|
DPI: layout.Size,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package entity
|
|||||||
import "image/color"
|
import "image/color"
|
||||||
|
|
||||||
type FontLayout struct {
|
type FontLayout struct {
|
||||||
|
Path string
|
||||||
DPI float64
|
DPI float64
|
||||||
Size float64
|
Size float64
|
||||||
Color color.Color
|
Color color.Color
|
||||||
|
|||||||
Reference in New Issue
Block a user