cogentcore / core

A free and open source framework for building powerful, fast, and elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the Web with a single pure Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.31k stars 71 forks source link

Error accessing to the fonts in girl/paint.FontLib #943

Closed Tom5521 closed 3 months ago

Tom5521 commented 3 months ago

Describe the bug

Just try to run the hello world example and I get this error, by the way, I'm on linux.

How to reproduce

Trying to make the documentation hello world

Example code

package main

import (
    "cogentcore.org/core/gi"
)

func main() {
    b := gi.NewBody("Hi")
    gi.NewButton(b).SetText("Hello World!")
    b.RunMainWindow()
}

Relevant output

2024/03/20 17:48:56 ERROR girl/paint.FontLib: error accessing path path=. err=stat .: no such file or directory
2024/03/20 17:48:56 ERROR girl/paint.FontLib: error walking path path=/usr/share/fonts/truetype err=stat .: no such file or directory

Platform

Linux

Tom5521 commented 3 months ago

I solved it by making a sudo ln -s /usr/share/fonts/TTF/ /usr/share/fonts/truetype

Either way, I think that's something that needs to be fixed.

kkoreilly commented 3 months ago

Indeed, this should not happen. What distro of linux are you using? From some quick searching, it seems like most distros of linux store their fonts in /usr/share/fonts/truetype. Regardless, I will add support for finding fonts in /usr/share/fonts/TTF.

Tom5521 commented 3 months ago

What distro of linux are you using?

I'm using Arch Linux

kkoreilly commented 3 months ago

I implemented a fix for this in the commit above; can you remove your symlink, update to the latest version of Cogent Core (go get cogentcore.org/core@a33095d), and ensure that the error does not happen again?

Tom5521 commented 3 months ago

The error no longer occurs, now it works correctly, thank you.