Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bsdf/uniclolde
uniclolde -- a unicode alphabet lib for go
https://github.com/bsdf/uniclolde
Last synced: 3 days ago
JSON representation
uniclolde -- a unicode alphabet lib for go
- Host: GitHub
- URL: https://github.com/bsdf/uniclolde
- Owner: bsdf
- Created: 2012-07-15T19:24:10.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-07-16T02:16:42.000Z (over 12 years ago)
- Last Synced: 2023-03-12T00:41:38.154Z (almost 2 years ago)
- Language: Go
- Size: 93.8 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
`go get -u github.com/bsdf/uniclolde`
```go
package mainimport (
"flag"
"fmt"
"github.com/bsdf/uniclolde"
"strings"
)var font = flag.String("f", "fullw", "font to use. type -l to list fonts")
var list = flag.Bool("l", false, "list available fonts")type fontFunc func(string) string
var fonts = map[string]fontFunc{
"fullw": uniclolde.FullWidth,
"mathb": uniclolde.MathBold,
"mathi": uniclolde.MathItalic,
"mathbi": uniclolde.MathBoldItalic,
"ss": uniclolde.SansSerif,
"ssb": uniclolde.SansSerifBold,
"ssi": uniclolde.SansSerifItalic,
"ssbi": uniclolde.SansSerifBoldItalic,
"mono": uniclolde.Monospace,
}func main() {
flag.Parse()if *list || len(flag.Args()) == 0 {
listFonts()
return
}if f, ok := fonts[*font]; ok {
str := strings.Join(flag.Args(), " ")
fmt.Printf("%s\n", f(str))
} else {
fmt.Printf("\"%s\" is not a known font.\n\n", *font)
listFonts()
}
}func listFonts() {
fmt.Println("available fonts:")
for k, f := range fonts {
fmt.Printf("\t%s:\t%s\n", k, f("HeLLo WoRLd!!!!"))
}
}
```