examples/fullscreen: Use golang.org/x/image/font/opentype

Updates #484
This commit is contained in:
Hajime Hoshi 2020-09-28 02:26:32 +09:00
parent 013a42ddb8
commit b264a421ae

View File

@ -26,8 +26,8 @@ import (
"log"
"math"
"github.com/golang/freetype/truetype"
"golang.org/x/image/font"
"golang.org/x/image/font/opentype"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/examples/resources/fonts"
@ -59,17 +59,20 @@ func init() {
}
func initFont() {
tt, err := truetype.Parse(fonts.MPlus1pRegular_ttf)
tt, err := opentype.Parse(fonts.MPlus1pRegular_ttf)
if err != nil {
log.Fatal(err)
}
const dpi = 72
mplusFont = truetype.NewFace(tt, &truetype.Options{
mplusFont, err = opentype.NewFace(tt, &opentype.FaceOptions{
Size: 12 * ebiten.DeviceScaleFactor(),
DPI: dpi,
Hinting: font.HintingFull,
})
if err != nil {
log.Fatal(err)
}
}
type Game struct {