mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-14 04:38:00 -08:00
fix(font): install all fonts in zip file
This commit is contained in:
parent
865374a0f5
commit
c5feb08791
|
@ -7,7 +7,6 @@ import (
|
|||
"bytes"
|
||||
"io"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -38,10 +37,10 @@ func InstallZIP(data []byte) (err error) {
|
|||
continue
|
||||
}
|
||||
|
||||
if _, ok := fonts[fontData.Name]; !ok {
|
||||
if _, found := fonts[fontData.Name]; !found {
|
||||
fonts[fontData.Name] = fontData
|
||||
} else {
|
||||
// Prefer OTF over TTF; otherwise prefer the first font we found.
|
||||
// prefer OTF over TTF; otherwise prefer the first font we find
|
||||
first := strings.ToLower(path.Ext(fonts[fontData.Name].FileName))
|
||||
second := strings.ToLower(path.Ext(fontData.FileName))
|
||||
if first != second && second == ".otf" {
|
||||
|
@ -51,11 +50,6 @@ func InstallZIP(data []byte) (err error) {
|
|||
}
|
||||
|
||||
for _, font := range fonts {
|
||||
if !shouldInstall(font.Name) {
|
||||
continue
|
||||
}
|
||||
|
||||
// print("Installing %s", font.Name)
|
||||
if err = install(font); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -63,13 +57,3 @@ func InstallZIP(data []byte) (err error) {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func shouldInstall(name string) bool {
|
||||
name = strings.ToLower(name)
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
return strings.Contains(name, "windows compatible")
|
||||
default:
|
||||
return !strings.Contains(name, "windows compatible")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue