mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
7b3294064d
commit
aa9f7f7c19
@ -22,8 +22,8 @@ import (
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"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"
|
||||
@ -37,27 +37,36 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
tt, err := truetype.Parse(fonts.MPlus1pRegular_ttf)
|
||||
tt, err := opentype.Parse(fonts.MPlus1pRegular_ttf)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
const dpi = 72
|
||||
mplusSmallFont = truetype.NewFace(tt, &truetype.Options{
|
||||
mplusSmallFont, err = opentype.NewFace(tt, &opentype.FaceOptions{
|
||||
Size: 24,
|
||||
DPI: dpi,
|
||||
Hinting: font.HintingFull,
|
||||
})
|
||||
mplusNormalFont = truetype.NewFace(tt, &truetype.Options{
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
mplusNormalFont, err = opentype.NewFace(tt, &opentype.FaceOptions{
|
||||
Size: 32,
|
||||
DPI: dpi,
|
||||
Hinting: font.HintingFull,
|
||||
})
|
||||
mplusBigFont = truetype.NewFace(tt, &truetype.Options{
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
mplusBigFont, err = opentype.NewFace(tt, &opentype.FaceOptions{
|
||||
Size: 48,
|
||||
DPI: dpi,
|
||||
Hinting: font.HintingFull,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// TileData represents a tile information like a value and a position.
|
||||
|
Loading…
Reference in New Issue
Block a user