From 065519f5afaf42e471279534b1be613d037a9a9c Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sun, 22 Dec 2024 17:27:45 +0100 Subject: [PATCH] fix(fonts): only install tff for CascadiaCode --- src/font/fonts.go | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/src/font/fonts.go b/src/font/fonts.go index 0cf08ef2871b..bd1fa8d6d922 100644 --- a/src/font/fonts.go +++ b/src/font/fonts.go @@ -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 }) @@ -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 }