diff --git a/examples/flappy/main.go b/examples/flappy/main.go index 981624e3b..87d76b119 100644 --- a/examples/flappy/main.go +++ b/examples/flappy/main.go @@ -27,8 +27,8 @@ import ( "math/rand" "time" - "github.com/golang/freetype/truetype" "golang.org/x/image/font" + "golang.org/x/image/font/opentype" "github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten/audio" @@ -92,21 +92,27 @@ func init() { } func init() { - tt, err := truetype.Parse(fonts.ArcadeN_ttf) + tt, err := opentype.Parse(fonts.PressStart2P_ttf) if err != nil { log.Fatal(err) } const dpi = 72 - arcadeFont = truetype.NewFace(tt, &truetype.Options{ + arcadeFont, err = opentype.NewFace(tt, &opentype.FaceOptions{ Size: fontSize, DPI: dpi, Hinting: font.HintingFull, }) - smallArcadeFont = truetype.NewFace(tt, &truetype.Options{ + if err != nil { + log.Fatal(err) + } + smallArcadeFont, err = opentype.NewFace(tt, &opentype.FaceOptions{ Size: smallFontSize, DPI: dpi, Hinting: font.HintingFull, }) + if err != nil { + log.Fatal(err) + } } var ( diff --git a/examples/piano/main.go b/examples/piano/main.go index e8706dab5..5bcd771c9 100644 --- a/examples/piano/main.go +++ b/examples/piano/main.go @@ -22,8 +22,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/audio" @@ -38,7 +38,7 @@ var ( ) func init() { - tt, err := truetype.Parse(fonts.ArcadeN_ttf) + tt, err := opentype.Parse(fonts.PressStart2P_ttf) if err != nil { log.Fatal(err) } @@ -47,11 +47,14 @@ func init() { arcadeFontSize = 8 dpi = 72 ) - arcadeFont = truetype.NewFace(tt, &truetype.Options{ + arcadeFont, err = opentype.NewFace(tt, &opentype.FaceOptions{ Size: arcadeFontSize, DPI: dpi, Hinting: font.HintingFull, }) + if err != nil { + log.Fatal(err) + } } const (