Text with an invalid span is silently not rendered
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
`main` (0.16.0-dev)
## What you did
```rs
commands.spawn((
Text::new("Hello, "),
TextFont::from_font(font_a),
)).with_child(
TextSpan::new("World!"),
TextFont::from_font(font_b),
)).with_child(TextSpan::new(" :)"));
```
## What went wrong
When one of `font_a` or `font_b` is not a valid handle to a font (e.g. if the asset is still loading, or if `Handle::default()` is used while bevy's default font feature is disabled), the entire text will be invisible with no warning emitted. It can be difficult to trace down why the text isn't rendering, because it looks like the issue is "higher up" than it actually is, and you'd need good tooling for inspecting entities and font handles.
Suggestions:
1. Log a warning like "text span {id} is using an invalid font handle {handle}, so the entire text cannot be rendered".
2. Render the rest of the text, skipping only the invalid spans.
3. Render the rest of the text, replacing invalid spans with � or similar.
4. Suggestion (2) or (3) but also log a warning.
Personal preference towards 2 or 4, but 1 is good enough.
## Additional information
A similar issue can happen when setting a font size of `f32::NAN`, but the effects of doing so are inconsistent.
Contributor guide
Assessment
This issue has not been assessed yet.