Skip to content

Commit

Permalink
feat: embed font into binary
Browse files Browse the repository at this point in the history
  • Loading branch information
crebsy committed Jul 19, 2024
1 parent 4a50846 commit f44a453
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion banner.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package main

import (
"embed"

"github.com/mbndr/figlet4go"
)

//go:embed fonts/block.flf
var embedFS embed.FS

func getBanner() string {
ascii := figlet4go.NewAsciiRender()

Expand All @@ -17,7 +22,11 @@ func getBanner() string {
tc,
}
options.FontName = "block"
ascii.LoadFont(".")
fontBytes, err := embedFS.ReadFile("fonts/block.flf")
if err != nil {
panic(err)
}
ascii.LoadBindataFont(fontBytes, "block")
renderStr, _ := ascii.RenderOpts("moonsnap", options)
return renderStr
}

0 comments on commit f44a453

Please sign in to comment.