mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix(fonts): use new rasterizer, all icons work
This commit is contained in:
parent
6c44459b6f
commit
64eeb400c5
|
@ -42,8 +42,8 @@ import (
|
||||||
|
|
||||||
"github.com/esimov/stackblur-go"
|
"github.com/esimov/stackblur-go"
|
||||||
"github.com/fogleman/gg"
|
"github.com/fogleman/gg"
|
||||||
"github.com/golang/freetype/truetype"
|
|
||||||
"golang.org/x/image/font"
|
"golang.org/x/image/font"
|
||||||
|
"golang.org/x/image/font/opentype"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConnectionError struct {
|
type ConnectionError struct {
|
||||||
|
@ -217,7 +217,7 @@ func (ir *ImageRenderer) loadFonts() error {
|
||||||
|
|
||||||
// Download font if not cached
|
// Download font if not cached
|
||||||
if data == nil {
|
if data == nil {
|
||||||
url := "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.0/Hack.zip"
|
url := "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Hack.zip"
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
data, err = fontCLI.Download(url)
|
data, err = fontCLI.Download(url)
|
||||||
|
@ -237,7 +237,7 @@ func (ir *ImageRenderer) loadFonts() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fontFaceOptions := &truetype.Options{Size: 2.0 * 12, DPI: 144}
|
fontFaceOptions := &opentype.FaceOptions{Size: 2.0 * 12, DPI: 144}
|
||||||
|
|
||||||
parseFont := func(file *zip.File) (font.Face, error) {
|
parseFont := func(file *zip.File) (font.Face, error) {
|
||||||
rc, err := file.Open()
|
rc, err := file.Open()
|
||||||
|
@ -252,12 +252,16 @@ func (ir *ImageRenderer) loadFonts() error {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
font, err := truetype.Parse(data)
|
font, err := opentype.Parse(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return truetype.NewFace(font, fontFaceOptions), nil
|
fontFace, err := opentype.NewFace(font, fontFaceOptions)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return fontFace, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range zipReader.File {
|
for _, file := range zipReader.File {
|
||||||
|
|
|
@ -10,7 +10,6 @@ require (
|
||||||
github.com/alecthomas/repr v0.4.0 // indirect
|
github.com/alecthomas/repr v0.4.0 // indirect
|
||||||
github.com/esimov/stackblur-go v1.1.0
|
github.com/esimov/stackblur-go v1.1.0
|
||||||
github.com/fogleman/gg v1.3.0
|
github.com/fogleman/gg v1.3.0
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/gookit/color v1.5.4
|
github.com/gookit/color v1.5.4
|
||||||
github.com/huandu/xstrings v1.4.0 // indirect
|
github.com/huandu/xstrings v1.4.0 // indirect
|
||||||
|
@ -70,6 +69,7 @@ require (
|
||||||
github.com/containerd/console v1.0.4 // indirect
|
github.com/containerd/console v1.0.4 // indirect
|
||||||
github.com/dsnet/compress v0.0.1 // indirect
|
github.com/dsnet/compress v0.0.1 // indirect
|
||||||
github.com/fatih/color v1.16.0 // indirect
|
github.com/fatih/color v1.16.0 // indirect
|
||||||
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||||
github.com/google/go-cmp v0.6.0 // indirect
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||||
|
|
Loading…
Reference in a new issue