From 61cb51730c2e3dbbea544a0ff5bc6628be76a54d Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 12 Nov 2019 16:28:11 +0000 Subject: Clean up, and add comment explaining design choice to fonttobytes --- fonttobytes/main.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fonttobytes/main.go b/fonttobytes/main.go index ed0752c..8310e0f 100644 --- a/fonttobytes/main.go +++ b/fonttobytes/main.go @@ -36,15 +36,14 @@ func main() { 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{") - first := true - for _, b := range compressed.Bytes() { - if first { - fmt.Printf("%d", b) - first = false - continue + for i, b := range compressed.Bytes() { + if i > 0 { + fmt.Printf(", ") } - fmt.Printf(", %d", b) + fmt.Printf("%d", b) } fmt.Printf("}\n") } -- cgit v1.2.1-24-ge1ad