everything I got

This commit is contained in:
MrDonuts
2023-11-19 20:53:35 -05:00
commit a875a4ed57
45 changed files with 903 additions and 0 deletions

37
assets/fonts.go Normal file
View File

@@ -0,0 +1,37 @@
package assets
import (
"embed"
"log"
"golang.org/x/image/font"
"golang.org/x/image/font/opentype"
)
//go:embed *
var FontFiles embed.FS
var fontFace font.Face
func LoadFontFace(fileName string, size float64) font.Face {
fontBytes, err := FontFiles.ReadFile(fileName)
if err != nil {
log.Fatal(err)
}
tt, err := opentype.Parse(fontBytes)
if err != nil {
log.Fatal(err)
}
const dpi = 144
fontFace, err = opentype.NewFace(tt, &opentype.FaceOptions{
Size: size,
DPI: dpi,
Hinting: font.HintingNone,
})
if err != nil {
log.Fatal(err)
}
return fontFace
}