2024-10-21 01:30:26 +02:00
|
|
|
package fonts
|
|
|
|
|
|
|
|
import (
|
2024-11-02 17:50:15 +01:00
|
|
|
"os"
|
2024-10-21 01:30:26 +02:00
|
|
|
"xyosc/utils"
|
|
|
|
|
|
|
|
"github.com/flopp/go-findfont"
|
2024-11-02 17:50:15 +01:00
|
|
|
"github.com/hajimehoshi/ebiten/v2/text/v2"
|
2024-10-21 01:30:26 +02:00
|
|
|
)
|
|
|
|
|
2024-11-02 17:50:15 +01:00
|
|
|
var Font *text.GoTextFaceSource
|
2024-10-21 01:30:26 +02:00
|
|
|
|
|
|
|
func Init() {
|
|
|
|
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
|
|
|
|
fontPath, err := findfont.Find("SourceHanSansJP-Heavy.otf")
|
|
|
|
utils.CheckError(err)
|
2024-11-02 17:50:15 +01:00
|
|
|
f, err := os.Open(fontPath)
|
|
|
|
utils.CheckError(err)
|
|
|
|
Font, err = text.NewGoTextFaceSource(f)
|
|
|
|
utils.CheckError(err)
|
2024-10-21 01:30:26 +02:00
|
|
|
}
|