From 3880414bbf2d6f2cd05e208abf919ae5ceabeddc Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 27 Feb 2020 17:45:16 +0000 Subject: Reorganise all commands to be behind cmd/ --- fonttobytes/main.go | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 fonttobytes/main.go (limited to 'fonttobytes') diff --git a/fonttobytes/main.go b/fonttobytes/main.go deleted file mode 100644 index 8310e0f..0000000 --- a/fonttobytes/main.go +++ /dev/null @@ -1,49 +0,0 @@ -package main - -import ( - "bytes" - "compress/zlib" - "flag" - "fmt" - "io/ioutil" - "log" - "os" -) - -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 - } - - f, err := os.Open(flag.Arg(0)) - if err != nil { - log.Fatalln("Failed to open file", flag.Arg(0), err) - } - fontbytes, err := ioutil.ReadAll(f) - if err != nil { - log.Fatalln("Failed to read file", flag.Arg(0), err) - } - - var compressed bytes.Buffer - w := zlib.NewWriter(&compressed) - w.Write(fontbytes) - w.Close() - - // This could be done with %+v in printf, but using the decimal rather than - // hex output saves quite a few bytes, so we do that instead. - fmt.Printf("[]byte{") - for i, b := range compressed.Bytes() { - if i > 0 { - fmt.Printf(", ") - } - fmt.Printf("%d", b) - } - fmt.Printf("}\n") -} -- cgit v1.2.1-24-ge1ad