Skip to content

Commit

Permalink
Move to go1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Nov 7, 2024
1 parent 8b84826 commit 6d8eb19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/kenshaw/fv

go 1.22.0

toolchain go1.22.1
go 1.23

require (
github.com/kenshaw/colors v0.1.6
Expand All @@ -11,7 +9,6 @@ require (
github.com/spf13/pflag v1.0.5
github.com/tdewolff/canvas v0.0.0-20241107191514-17a7fb09dce2
github.com/tdewolff/font v0.0.0-20240728193914-9dc6e3441d03
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
)

require (
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 h1:IkjBCtQOOjIn03
github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8=
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
Expand Down
22 changes: 7 additions & 15 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"image/color"
"io"
"maps"
"os"
"path/filepath"
"regexp"
Expand All @@ -28,7 +29,6 @@ import (
"github.com/tdewolff/canvas"
"github.com/tdewolff/canvas/renderers/rasterizer"
fontpkg "github.com/tdewolff/font"
"golang.org/x/exp/maps"
)

var (
Expand Down Expand Up @@ -213,31 +213,23 @@ func doAll(w io.Writer, sysfonts *fontpkg.SystemFonts, args *Args) error {
if !rasterm.Available() {
return rasterm.ErrTermGraphicsNotAvailable
}
families := maps.Keys(sysfonts.Fonts)
slices.Sort(families)
// collect fonts
var fonts []*Font
for _, family := range families {
styles := maps.Keys(sysfonts.Fonts[family])
slices.Sort(styles)
for _, style := range styles {
for _, family := range slices.Sorted(maps.Keys(sysfonts.Fonts)) {
for _, style := range slices.Sorted(maps.Keys(sysfonts.Fonts[family])) {
fonts = append(fonts, NewFont(sysfonts.Fonts[family][style]))
}
}
return render(w, fonts, args)
}

func doList(w io.Writer, sysfonts *fontpkg.SystemFonts, _ *Args) error {
families := maps.Keys(sysfonts.Fonts)
slices.Sort(families)
for i := 0; i < len(families); i++ {
for _, family := range slices.Sorted(maps.Keys(sysfonts.Fonts)) {
fmt.Fprintln(w, "---")
fmt.Fprintf(w, "family: %q\n", families[i])
fmt.Fprintf(w, "family: %q\n", family)
fmt.Fprintln(w, "styles:")
styles := maps.Keys(sysfonts.Fonts[families[i]])
slices.Sort(styles)
for _, style := range styles {
fmt.Fprintf(w, " %s: %s\n", style, sysfonts.Fonts[families[i]][style].Filename)
for _, style := range slices.Sorted(maps.Keys(sysfonts.Fonts[family])) {
fmt.Fprintf(w, " %s: %s\n", style, sysfonts.Fonts[family][style].Filename)
}
}
return nil
Expand Down

0 comments on commit 6d8eb19

Please sign in to comment.