Closed coolit closed 3 years ago
Why no error will occur if I cargo run it?
This is probably a result of the "root" asset path changing based on the context. If you "cargo run" it will use the cargo workspace as the root folder. if you run a binary, it will use the binary's parent folder as the root. Just copy the asset folder to live next to the binary. (sorry this behavior isn't documented yet)
Why does error also occasionally occur with other Chinese fonts?
If you fix the "asset folder" issue and fonts still don't load, can you send me the fonts so I can test them?
Found a new error after running the same binary 3 times. The first 2 times failed. The final one didn't.
hmm seems like a pretty nasty timing issue. we should fix this asap.
I just hit this error again on my computer. This is 100% a timing issue where we aren't being forgiving of fonts that are still loading. I think we can fix this pretty easily.
Also just ran into this when trying to run any of the bevy_rapier (https://github.com/dimforge/bevy_rapier) examples. They don't seem to contain any chinese fonts though. I'm on MacOS and here's a log, if that helps
Fixed by #490
I used a custom font (which supports Chinese characters) to build the button example.
If I cargo run from IDE, no error will occur. And if I run the target exe directly from the target-dir, the following error occurred: thread '' panicked at 'called
Option::unwrap()
on aNone
value', crates\bevy_text\src\font_atlas_set.rs:53:20I tried other Chinese fonts, they all worked fine in most cases. And I guess it was just due to that specific font, which was a home-made one.
So two questions: