Skip to content

Commit

Permalink
fix(fonts): only install tff for CascadiaCode
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Dec 22, 2024
1 parent 594873b commit 065519f
Showing 1 changed file with 6 additions and 28 deletions.
34 changes: 6 additions & 28 deletions src/font/fonts.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func Fonts() ([]*Asset, error) {

cascadiaCode, err := CascadiaCode()
if err == nil {
assets = append(assets, cascadiaCode...)
assets = append(assets, cascadiaCode)
}

sort.Slice(assets, func(i, j int) bool { return assets[i].Name < assets[j].Name })
Expand Down Expand Up @@ -85,38 +85,16 @@ func setCachedFontData(assets []*Asset) {
cache.Set(cache_.FONTLISTCACHE, string(data), cache_.ONEDAY)
}

func CascadiaCode() ([]*Asset, error) {
func CascadiaCode() (*Asset, error) {
assets, err := fetchFontAssets("microsoft/cascadia-code")
if err != nil || len(assets) != 1 {
return nil, errors.New("no assets found")
}

return []*Asset{
{
Name: fmt.Sprintf("%s - TTF", CascadiaCodeMS),
URL: assets[0].URL,
Folder: "ttf/",
},
{
Name: fmt.Sprintf("%s - TTF Static", CascadiaCodeMS),
URL: assets[0].URL,
Folder: "ttf/static/",
},
{
Name: fmt.Sprintf("%s - OTF Static", CascadiaCodeMS),
URL: assets[0].URL,
Folder: "otf/static/",
},
{
Name: fmt.Sprintf("%s - WOFF2", CascadiaCodeMS),
URL: assets[0].URL,
Folder: "woff2/static/",
},
{
Name: fmt.Sprintf("%s - WOFF2 Static", CascadiaCodeMS),
URL: assets[0].URL,
Folder: "woff2/static/",
},
return &Asset{
Name: CascadiaCodeMS,
URL: assets[0].URL,
Folder: "ttf/",
}, nil
}

Expand Down

0 comments on commit 065519f

Please sign in to comment.