use bindata for the ascii fonts

This commit is contained in:
sqshq 2019-02-24 01:14:12 -05:00
parent ee2b2ab3e2
commit 8790d2f966
9 changed files with 68 additions and 3170 deletions

File diff suppressed because one or more lines are too long

View File

@ -13,10 +13,10 @@ func NewAssetFile(data []byte) AssetFile {
return AssetFile{bytes.NewReader(data)} return AssetFile{bytes.NewReader(data)}
} }
func (self AssetFile) Read(p []byte) (n int, err error) { func (a AssetFile) Read(p []byte) (n int, err error) {
return self.reader.Read(p) return a.reader.Read(p)
} }
func (self AssetFile) Close() error { func (a AssetFile) Close() error {
return nil return nil
} }

View File

@ -1,924 +0,0 @@
flf2a$ 9 6 30 1 5
larry3d.flf by Larry Gelberg (larryg@avs.com)
(stolen liberally from Juan Car's puffy.flf)
tweaked by Glenn Chappell <ggc@uiuc.edu>
Version 1.2 2/24/94
$@
$@
$@
$@
$@
$@
$@
$@
@@
__ @
/\ \ @
\ \ \ @
\ \ \ @
\ \_\ @
\/\_\@
\/_/@
@
@@
__ __ @
/\ \\ \ @
\ \_\\_\ @
\/_//_/$ @
$ $ @
$ $@
@
@
@@
__ __ @
_\ \\ \__ @
/\__ _ _\ @
\/_L\ \\ \L_ @
/\_ _ _\@
\/_/\_\\_\/@
\/_//_/ @
@
@@
__ @
/\ \_ @
\/'__`\ @
/\ \_\_\ @
\ \____ \ @
\/\ \_\ \@
\ `\_ _/@
`\_/\_\@
\/_/@@
__ __ @
/\_\ / / @
\/_/ / / @
/ / @
/ / __ @
/_/ /\_\@
/_/ \/_/@
@
@@
____ @
/| _ \ @
|/\ | @
\// __`\/\ @
/| \L> <_@
| \_____/\/@
\/____/\/ @
@
@@
__ @
/\ \ @
\ \/$ @
\/ $ @
$ $ @
$ $@
@
@
@@
_ @
/' \ @
/\ ,/' @
\ \ \ @
\ \ `\ @
\ `\__\@
`\/_/ @
@
@@
__ @
/\ `\ @
\`\ \ @
`\`\ \ @
`\/' \@
/\__/@
\/_/ @
@
@@
__ @
_\ \ _ @
/\_` ' \ @
\/_> <_ @
/\_, ,_\@
\/_/\_\/@
\/_/ @
@
@@
__ @
/\ \ @
\_\ \___ @
/\___ __\@
\/__/\ \_/@
\ \_\ @
\/_/ @
@
@@
@
@
@
@
__ @
/\ \@
\ \/@
\/ @
@@
@
@
@
_______ @
/\______\@
\/______/@
@
@
@@
@
@
@
@
__ @
/\_\@
\/_/@
@
@@
__@
/ /@
/ / @
/ / @
/ / @
/_/ @
/_/ @
@
@@
__ @
/'__`\ @
/\ \/\ \ @
\ \ \ \ \ @
\ \ \_\ \ @
\ \____/ @
\/___/ @
@
@@
_ @
/' \ @
/\_, \ @
\/_/\ \ @
\ \ \ @
\ \_\ @
\/_/ @
@
@@
___ @
/'___`\ @
/\_\ /\ \ @
\/_/// /__ @
// /_\ \@
/\______/@
\/_____/ @
@
@@
__ @
/'__`\ @
/\_\L\ \ @
\/_/_\_<_ @
/\ \L\ \ @
\ \____/ @
\/___/ @
@
@@
__ __ @
/\ \\ \ @
\ \ \\ \ @
\ \ \\ \_ @
\ \__ ,_\@
\/_/\_\/@
\/_/ @
@
@@
______ @
/\ ___\ @
\ \ \__/ @
\ \___``\ @
\/\ \L\ \@
\ \____/@
\/___/ @
@
@@
____ @
/'___\ @
/\ \__/ @
\ \ _``\ @
\ \ \L\ \ @
\ \____/ @
\/___/ @
@
@@
________ @
/\_____ \ @
\/___//'/' @
/' /' @
/' /' @
/\_/ @
\// @
@
@@
__ @
/'_ `\ @
/\ \L\ \ @
\/_> _ <_ @
/\ \L\ \ @
\ \____/ @
\/___/ @
@
@@
__ @
/'_ `\ @
/\ \L\ \ @
\ \___, \ @
\/__,/\ \ @
\ \_\@
\/_/@
@
@@
@
@
__ @
/\_\ @
\/_/_ @
/\_\@
\/_/@
@
@@
@
@
__ @
/\_\ @
\/_/_ @
/\ \@
\ \/@
\/ @
@@
___ @
/ / @
/ / @
/< < @
\ `\ `\ @
`\ `\_|@
`\// @
@
@@
@
_______ @
/\______\ @
\/______/_ @
/\______\@
\/______/@
@
@
@@
__ @
/\ `\ @
\ `\ `\ @
`\ > >@
/ / @
/\_/ @
\// @
@
@@
_ @
/'_`\ @
/\_\/\`\@
\/_//'/'@
/\_\ @
\/\_\@
\/_/@
@
@@
@
__ @
/'_`\_ @
/'/'_` \ @
/\ \ \L\ \ @
\ \ `\__,_\@
\ `\_____\@
`\/_____/@
@@
______ @
/\ _ \ @
\ \ \L\ \ @
\ \ __ \ @
\ \ \/\ \ @
\ \_\ \_\@
\/_/\/_/@
@
@@
____ @
/\ _`\ @
\ \ \L\ \ @
\ \ _ <' @
\ \ \L\ \@
\ \____/@
\/___/ @
@
@@
____ @
/\ _`\ @
\ \ \/\_\ @
\ \ \/_/_ @
\ \ \L\ \@
\ \____/@
\/___/ @
@
@@
____ @
/\ _`\ @
\ \ \/\ \ @
\ \ \ \ \ @
\ \ \_\ \@
\ \____/@
\/___/ @
@
@@
____ @
/\ _`\ @
\ \ \L\_\ @
\ \ _\L @
\ \ \L\ \@
\ \____/@
\/___/ @
@
@@
____ @
/\ _`\ @
\ \ \L\_\@
\ \ _\/@
\ \ \/ @
\ \_\ @
\/_/ @
@
@@
____ @
/\ _`\ @
\ \ \L\_\ @
\ \ \L_L @
\ \ \/, \@
\ \____/@
\/___/ @
@
@@
__ __ @
/\ \/\ \ @
\ \ \_\ \ @
\ \ _ \ @
\ \ \ \ \ @
\ \_\ \_\@
\/_/\/_/@
@
@@
______ @
/\__ _\ @
\/_/\ \/ @
\ \ \ @
\_\ \__ @
/\_____\@
\/_____/@
@
@@
_____ @
/\___ \ @
\/__/\ \ @
_\ \ \ @
/\ \_\ \@
\ \____/@
\/___/ @
@
@@
__ __ @
/\ \/\ \ @
\ \ \/'/' @
\ \ , < @
\ \ \\`\ @
\ \_\ \_\@
\/_/\/_/@
@
@@
__ @
/\ \ @
\ \ \ @
\ \ \ __ @
\ \ \L\ \@
\ \____/@
\/___/ @
@
@@
@
/'\_/`\ @
/\ \ @
\ \ \__\ \ @
\ \ \_/\ \ @
\ \_\\ \_\@
\/_/ \/_/@
@
@@
__ __ @
/\ \/\ \ @
\ \ `\\ \ @
\ \ , ` \ @
\ \ \`\ \ @
\ \_\ \_\@
\/_/\/_/@
@
@@
_____ @
/\ __`\ @
\ \ \/\ \ @
\ \ \ \ \ @
\ \ \_\ \ @
\ \_____\@
\/_____/@
@
@@
____ @
/\ _`\ @
\ \ \L\ \@
\ \ ,__/@
\ \ \/ @
\ \_\ @
\/_/ @
@
@@
_____ @
/\ __`\ @
\ \ \/\ \ @
\ \ \ \ \ @
\ \ \\'\\ @
\ \___\_\@
\/__//_/@
@
@@
____ @
/\ _`\ @
\ \ \L\ \ @
\ \ , / @
\ \ \\ \ @
\ \_\ \_\@
\/_/\/ /@
@
@@
____ @
/\ _`\ @
\ \,\L\_\ @
\/_\__ \ @
/\ \L\ \ @
\ `\____\@
\/_____/@
@
@@
______ @
/\__ _\ @
\/_/\ \/ @
\ \ \ @
\ \ \ @
\ \_\@
\/_/@
@
@@
__ __ @
/\ \/\ \ @
\ \ \ \ \ @
\ \ \ \ \ @
\ \ \_\ \ @
\ \_____\@
\/_____/@
@
@@
__ __ @
/\ \/\ \ @
\ \ \ \ \ @
\ \ \ \ \ @
\ \ \_/ \@
\ `\___/@
`\/__/ @
@
@@
__ __ @
/\ \ __/\ \ @
\ \ \/\ \ \ \ @
\ \ \ \ \ \ \ @
\ \ \_/ \_\ \@
\ `\___x___/@
'\/__//__/ @
@
@@
__ __ @
/\ \ /\ \ @
\ `\`\/'/' @
`\/ > < @
\/'/\`\ @
/\_\\ \_\@
\/_/ \/_/@
@
@@
__ __ @
/\ \ /\ \@
\ `\`\\/'/@
`\ `\ /' @
`\ \ \ @
\ \_\@
\/_/@
@
@@
________ @
/\_____ \ @
\/____//'/' @
//'/' @
//'/'___ @
/\_______\@
\/_______/@
@
@@
____ @
/\ _\ @
\ \ \/ @
\ \ \ @
\ \ \_ @
\ \___\@
\/___/@
@
@@
__ @
/\ `\ @
\`\ `\ @
`\`\ `\ @
`\`\ `\ @
`\`\__\@
`\/__/@
@
@@
____ @
/\__ \ @
\/_/\ \ @
\ \ \ @
\_\ \ @
/\___\@
\/___/@
@
@@
__ @
/ `\ @
/\_/\_\ @
\//\// $ @
$ $ @
$ $@
@
@
@@
@
@
@
@
@
$ $ @
$_______ @
/\______\@
\/______/@@
__ @
/\ \ @
\ \\$ @
\// $ @
$ $ @
$ $@
@
@
@@
@
@
__ @
/'__`\ @
/\ \L\.\_ @
\ \__/.\_\@
\/__/\/_/@
@
@@
__ @
/\ \ @
\ \ \____ @
\ \ '__`\ @
\ \ \L\ \@
\ \_,__/@
\/___/ @
@
@@
@
@
___ @
/'___\ @
/\ \__/ @
\ \____\@
\/____/@
@
@@
__ @
/\ \ @
\_\ \ @
/'_` \ @
/\ \L\ \ @
\ \___,_\@
\/__,_ /@
@
@@
@
@
__ @
/'__`\ @
/\ __/ @
\ \____\@
\/____/@
@
@@
___ @
/'___\ @
/\ \__/ @
\ \ ,__\@
\ \ \_/@
\ \_\ @
\/_/ @
@
@@
@
@
__ @
/'_ `\ @
/\ \L\ \ @
\ \____ \ @
\/___L\ \@
/\____/@
\_/__/ @@
__ @
/\ \ @
\ \ \___ @
\ \ _ `\ @
\ \ \ \ \ @
\ \_\ \_\@
\/_/\/_/@
@
@@
@
__ @
/\_\ @
\/\ \ @
\ \ \ @
\ \_\@
\/_/@
@
@@
@
__ @
/\_\ @
\/\ \ @
\ \ \ @
_\ \ \ @
/\ \_\ \@
\ \____/@
\/___/ @@
__ @
/\ \ @
\ \ \/'\ @
\ \ , < @
\ \ \\`\ @
\ \_\ \_\@
\/_/\/_/@
@
@@
___ @
/\_ \ @
\//\ \ @
\ \ \ @
\_\ \_ @
/\____\@
\/____/@
@
@@
@
@
___ ___ @
/' __` __`\ @
/\ \/\ \/\ \ @
\ \_\ \_\ \_\@
\/_/\/_/\/_/@
@
@@
@
@
___ @
/' _ `\ @
/\ \/\ \ @
\ \_\ \_\@
\/_/\/_/@
@
@@
@
@
___ @
/ __`\ @
/\ \L\ \@
\ \____/@
\/___/ @
@
@@
@
@
_____ @
/\ '__`\ @
\ \ \L\ \@
\ \ ,__/@
\ \ \/ @
\ \_\ @
\/_/ @@
@
@
__ @
/'__`\ @
/\ \L\ \ @
\ \___, \ @
\/___/\ \ @
\ \_\@
\/_/@@
@
@
_ __ @
/\`'__\@
\ \ \/ @
\ \_\ @
\/_/ @
@
@@
@
@
____ @
/',__\ @
/\__, `\@
\/\____/@
\/___/ @
@
@@
__ @
/\ \__ @
\ \ ,_\ @
\ \ \/ @
\ \ \_ @
\ \__\@
\/__/@
@
@@
@
@
__ __ @
/\ \/\ \ @
\ \ \_\ \@
\ \____/@
\/___/ @
@
@@
@
@
__ __ @
/\ \/\ \ @
\ \ \_/ |@
\ \___/ @
\/__/ @
@
@@
@
@
__ __ __ @
/\ \/\ \/\ \ @
\ \ \_/ \_/ \@
\ \___x___/'@
\/__//__/ @
@
@@
@
@
__ _ @
/\ \/'\ @
\/> </ @
/\_/\_\@
\//\/_/@
@
@@
@
@
__ __ @
/\ \/\ \ @
\ \ \_\ \ @
\/`____ \ @
`/___/> \@
/\___/@
\/__/ @@
@
@
____ @
/\_ ,`\ @
\/_/ /_ @
/\____\@
\/____/@
@
@@
_ @
/' \@
\ ,/'@
<' \ @
< \ `\ @
\`\__\@
\/__/@
@
@@
__ @
/\ \ @
\ \ \ @
\ \ \ @
\ \ \ @
\ \ \ @
\ \ \ @
\ \_\@
\/_/@@
__ @
/\ `\ @
\`\ \ @
\ \ `>@
//' \ @
/\__/' @
\/_/ @
@
@ @
_ _ @
/' \/' \ @
/\_/\__//$ @
\//\/__/ $ @
$ $@
@
@
@
@@
__ __ @
/\_\/\_\ @
\/\ _ \ @
\ \ \L\ \ @
\ \ __ \ @
\ \_\/\_\@
\/_/\/_/@
@
@@
__ __ @
/\_\/\_\ @
\/\ __ \ @
\ \ \/\ \ @
\ \ \_\ \ @
\ \_____\@
\/_____/@
@
@ @
__ __ @
/\_\/\_\ @
\/\ \/\ \ @
\ \ \ \ \ @
\ \ \_\ \ @
\ \_____\@
\/_____/@
@
@ @
__ __ @
/\_\/\_\ @
\/_/\/_/_ @
/'_` \ @
/\ \L\ \ @
\ `\__,_\@
`\/_,__/@
@
@@
__ __ @
/\_\/\_\ @
\/_/\/_/ @
/'_`\ @
/\ \L\ \@
\ `\___/@
`\/__/ @
@
@@
__ __ @
/\_\ \_\ @
\/_/\/_/_ @
/\ \/\ \ @
\ \ \_\ \@
\ `\___/@
`\/__/ @
@
@@
______ @
/\ __ \ @
\ \ \/\ \ @
\ \ \<_<_ @
\ \ \ \ \@
\ \ \\_/@
\ \_\/ @
\/_/ @
@@

File diff suppressed because it is too large Load Diff

View File

@ -8,9 +8,9 @@ import (
"log" "log"
) )
func beep() error { func Beep() error {
bytes, err := Asset("quindar-tone") bytes, err := Asset("quindar-tone.mp3")
if err != nil { if err != nil {
log.Fatal("Can't find asset file") log.Fatal("Can't find asset file")
} }

View File

@ -1,7 +1,8 @@
package asciibox package asciibox
import ( import (
fl "github.com/mbndr/figlet4go" fl "github.com/sqshq/figlet4go"
"github.com/sqshq/sampler/asset"
"github.com/sqshq/sampler/data" "github.com/sqshq/sampler/data"
ui "github.com/sqshq/termui" ui "github.com/sqshq/termui"
"image" "image"
@ -28,15 +29,16 @@ func NewAsciiBox(title string, font AsciiFont, color ui.Color) *AsciiBox {
block := *ui.NewBlock() block := *ui.NewBlock()
block.Title = title block.Title = title
render := fl.NewAsciiRender()
err := render.LoadFont("asset/")
if err != nil {
panic("Can't load fonts: " + err.Error())
}
options := fl.NewRenderOptions() options := fl.NewRenderOptions()
options.FontName = string(font) options.FontName = string(font)
fontStr, err := asset.Asset(options.FontName + ".flf")
if err != nil {
panic("Can't load the font: " + err.Error())
}
render := fl.NewAsciiRender()
_ = render.LoadBindataFont(fontStr, options.FontName)
return &AsciiBox{ return &AsciiBox{
Block: block, Block: block,
style: ui.NewStyle(color), style: ui.NewStyle(color),

2
go.mod
View File

@ -4,8 +4,8 @@ require (
github.com/hajimehoshi/go-mp3 v0.1.1 github.com/hajimehoshi/go-mp3 v0.1.1
github.com/hajimehoshi/oto v0.1.1 github.com/hajimehoshi/oto v0.1.1
github.com/mattn/go-runewidth v0.0.4 github.com/mattn/go-runewidth v0.0.4
github.com/mbndr/figlet4go v0.0.0-20170909125910-47ded4d17030
github.com/mitchellh/go-wordwrap v1.0.0 // indirect github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/sqshq/figlet4go v0.0.0-20190224060604-5ce91d55ba00
github.com/sqshq/termui v0.0.0-20190125032456-731556c09f2c github.com/sqshq/termui v0.0.0-20190125032456-731556c09f2c
gopkg.in/yaml.v2 v2.2.2 gopkg.in/yaml.v2 v2.2.2
) )

4
go.sum
View File

@ -11,13 +11,13 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mbndr/figlet4go v0.0.0-20170909125910-47ded4d17030 h1:TSUoxTASZ3DmI7VDNX7/cbGlwz0OCp9RW07tUDnx3TQ=
github.com/mbndr/figlet4go v0.0.0-20170909125910-47ded4d17030/go.mod h1:QzTGLGoOqLHUBK8/EZ0v4Fa4CdyXmdyRwCHcl0YbeO4=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840=
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
github.com/sqshq/figlet4go v0.0.0-20190224060604-5ce91d55ba00 h1:HDXBCtVmmsZ0uMTd7CduTASlVECbRZhyAc0m3C+Dbjk=
github.com/sqshq/figlet4go v0.0.0-20190224060604-5ce91d55ba00/go.mod h1:8MTXZj469VoimW9vWH9LcL9Q3k1SRa+dgZdni8ZZw0o=
github.com/sqshq/termui v0.0.0-20190125032456-731556c09f2c h1:BBEmIcD4UhAHDVWi3PVuA5TxVTZxcjmYzmdvhWkPfvE= github.com/sqshq/termui v0.0.0-20190125032456-731556c09f2c h1:BBEmIcD4UhAHDVWi3PVuA5TxVTZxcjmYzmdvhWkPfvE=
github.com/sqshq/termui v0.0.0-20190125032456-731556c09f2c/go.mod h1:puWaguPLLYPPKabYPVhZ8sDNe0nKSMiKWRfLVaaX8Zs= github.com/sqshq/termui v0.0.0-20190125032456-731556c09f2c/go.mod h1:puWaguPLLYPPKabYPVhZ8sDNe0nKSMiKWRfLVaaX8Zs=
golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8=

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"github.com/sqshq/sampler/asset"
"github.com/sqshq/sampler/component" "github.com/sqshq/sampler/component"
"github.com/sqshq/sampler/component/asciibox" "github.com/sqshq/sampler/component/asciibox"
"github.com/sqshq/sampler/component/barchart" "github.com/sqshq/sampler/component/barchart"