61 lines
1.1 KiB
Go
61 lines
1.1 KiB
Go
package figlet
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"sevenkeys/constants"
|
|
"sevenkeys/logic"
|
|
|
|
"github.com/lukesampson/figlet/figletlib"
|
|
)
|
|
|
|
var (
|
|
FigletFontSlant *figletlib.Font
|
|
FigletFontTerm *figletlib.Font
|
|
)
|
|
|
|
func ReadFigletFonts() {
|
|
cwd, err := os.Getwd()
|
|
logic.Check(err)
|
|
|
|
fontsdir := filepath.Join(cwd, "fonts")
|
|
|
|
FigletFontSlant, err = figletlib.GetFontByName(fontsdir, "slant")
|
|
logic.Check(err)
|
|
|
|
FigletFontTerm, err = figletlib.GetFontByName(fontsdir, "term")
|
|
logic.Check(err)
|
|
}
|
|
|
|
func PrintMsgSlant(msg, alignment string) {
|
|
figletlib.PrintMsg(msg,
|
|
FigletFontSlant,
|
|
200,
|
|
FigletFontSlant.Settings(),
|
|
alignment)
|
|
}
|
|
|
|
func PrintMsgTerm(msg, alignment string) {
|
|
figletlib.PrintMsg(msg,
|
|
FigletFontTerm,
|
|
200,
|
|
FigletFontTerm.Settings(),
|
|
alignment)
|
|
}
|
|
|
|
func SprintMsgSlant(msg, alignment string) string {
|
|
return figletlib.SprintMsg(msg,
|
|
FigletFontSlant,
|
|
constants.WindowWidth,
|
|
FigletFontSlant.Settings(),
|
|
alignment)
|
|
}
|
|
|
|
func SprintMsgTerm(msg, alignment string) string {
|
|
return figletlib.SprintMsg(msg,
|
|
FigletFontTerm,
|
|
constants.WindowWidth,
|
|
FigletFontTerm.Settings(),
|
|
alignment)
|
|
}
|