2024-10-21 01:30:26 +02:00
|
|
|
package fonts
|
|
|
|
|
|
|
|
import (
|
|
|
|
"xyosc/utils"
|
|
|
|
|
2024-12-21 18:02:17 +01:00
|
|
|
"embed"
|
|
|
|
|
2024-11-02 17:50:15 +01:00
|
|
|
"github.com/hajimehoshi/ebiten/v2/text/v2"
|
2024-10-21 01:30:26 +02:00
|
|
|
)
|
|
|
|
|
2024-12-21 18:02:17 +01:00
|
|
|
//go:embed assets/SourceHanSansJP-Heavy.otf
|
|
|
|
var embedFS embed.FS
|
|
|
|
|
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)
|
2024-12-21 18:02:17 +01:00
|
|
|
f, err := embedFS.Open("assets/SourceHanSansJP-Heavy.otf")
|
2024-11-02 17:50:15 +01:00
|
|
|
utils.CheckError(err)
|
|
|
|
Font, err = text.NewGoTextFaceSource(f)
|
|
|
|
utils.CheckError(err)
|
2024-10-21 01:30:26 +02:00
|
|
|
}
|