Skip to content

Commit

Permalink
fix(image): set font cache before usage
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Dec 22, 2024
1 parent caece11 commit 30c914f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/font/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ func (m *main) View() string {
return ""
}

func SetCache(c cache_.Cache) {
cache = c
}

func Run(font string, ch cache_.Cache, root bool, zipFolder string) {
main := &main{
system: root,
Expand All @@ -360,7 +364,7 @@ func Run(font string, ch cache_.Cache, root bool, zipFolder string) {
},
}

cache = ch
SetCache(ch)

program = tea.NewProgram(main)
if _, err := program.Run(); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions src/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func (ir *Renderer) Init(env runtime.Environment) error {

ir.cleanContent()

font_.SetCache(env.Cache())

if err := ir.loadFonts(); err != nil {
return &ConnectionError{reason: err.Error()}
}
Expand Down

0 comments on commit 30c914f

Please sign in to comment.