fix(image): set font cache before usage

This commit is contained in:
Jan De Dobbeleer 2024-12-22 20:26:42 +01:00
parent caece11225
commit 30c914f65c
2 changed files with 7 additions and 1 deletions

View file

@ -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,
@ -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 {

View file

@ -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()}
}