Revert "examples/2048: Use golang.org/x/image/font/opentype"

This reverts commit aa9f7f7c19.

Reason: #1377
This commit is contained in:
Hajime Hoshi 2020-10-03 20:25:45 +09:00
parent 041377a9a2
commit 990ba69d7a

View File

@ -22,8 +22,8 @@ import (
"sort" "sort"
"strconv" "strconv"
"github.com/golang/freetype/truetype"
"golang.org/x/image/font" "golang.org/x/image/font"
"golang.org/x/image/font/opentype"
"github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/examples/resources/fonts" "github.com/hajimehoshi/ebiten/examples/resources/fonts"
@ -37,36 +37,27 @@ var (
) )
func init() { func init() {
tt, err := opentype.Parse(fonts.MPlus1pRegular_ttf) tt, err := truetype.Parse(fonts.MPlus1pRegular_ttf)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
const dpi = 72 const dpi = 72
mplusSmallFont, err = opentype.NewFace(tt, &opentype.FaceOptions{ mplusSmallFont = truetype.NewFace(tt, &truetype.Options{
Size: 24, Size: 24,
DPI: dpi, DPI: dpi,
Hinting: font.HintingFull, Hinting: font.HintingFull,
}) })
if err != nil { mplusNormalFont = truetype.NewFace(tt, &truetype.Options{
log.Fatal(err)
}
mplusNormalFont, err = opentype.NewFace(tt, &opentype.FaceOptions{
Size: 32, Size: 32,
DPI: dpi, DPI: dpi,
Hinting: font.HintingFull, Hinting: font.HintingFull,
}) })
if err != nil { mplusBigFont = truetype.NewFace(tt, &truetype.Options{
log.Fatal(err)
}
mplusBigFont, err = opentype.NewFace(tt, &opentype.FaceOptions{
Size: 48, Size: 48,
DPI: dpi, DPI: dpi,
Hinting: font.HintingFull, Hinting: font.HintingFull,
}) })
if err != nil {
log.Fatal(err)
}
} }
// TileData represents a tile information like a value and a position. // TileData represents a tile information like a value and a position.