diff options
author | Nick White <git@njw.name> | 2020-02-27 17:36:15 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-02-27 17:36:15 +0000 |
commit | 2d02e8cfee864b710b52db1cb0a5ab762d9ec5a8 (patch) | |
tree | 94204240413dab183c25a424cf3838faa0707bd1 /cmd/fonttobytes/main.go | |
parent | 05372a7d4ae1baaee2295753b340d654f99bed7c (diff) |
Remove fonttobytes (use the one in rescribe.xyz/utils repo instead)
Diffstat (limited to 'cmd/fonttobytes/main.go')
-rw-r--r-- | cmd/fonttobytes/main.go | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/cmd/fonttobytes/main.go b/cmd/fonttobytes/main.go deleted file mode 100644 index 860fae8..0000000 --- a/cmd/fonttobytes/main.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2019 Nick White. -// Use of this source code is governed by the GPLv3 -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "compress/zlib" - "flag" - "fmt" - "io/ioutil" - "log" -) - -func main() { - flag.Usage = func() { - fmt.Fprintln(flag.CommandLine.Output(), "Usage: fonttobytes font.ttf") - flag.PrintDefaults() - } - flag.Parse() - - if flag.NArg() != 1 { - flag.Usage() - return - } - - font, err := ioutil.ReadFile(flag.Arg(0)) - if err != nil { - log.Fatalln(err) - } - - // compress with zlib - var buf bytes.Buffer - w := zlib.NewWriter(&buf) - w.Write(font) - w.Close() - - // this could be done more simply with %+v, but that takes up - // significantly more space due to printing each byte in hex - // rather than dec format. - - fmt.Printf("[]byte{") - for i, b := range buf.Bytes() { - if i > 0 { - fmt.Printf(", ") - } - fmt.Printf("%d", b) - } - fmt.Printf("}\n") -} |