fix(engine): silence usvg font-substitution warn spam
CI / Test & Lint (push) Failing after 6s
CI / Release Build (push) Has been skipped

The bundled hayeah card SVGs declare font-family="Arial" for rank/suit
text. usvg matches family names exactly, so on systems without Arial
installed (every Linux distro by default) every text node bridged a
log::warn! into our tracing output — 50+ lines per launch.

Two-part fix:
- svg_loader now populates a process-wide fontdb with system fonts
  (lazy via OnceLock) so substitution actually has faces to fall
  through to. usvg::Options::default() ships an empty fontdb, which
  meant text glyphs had nothing to fall back on at all.
- LogPlugin extends DEFAULT_FILTER with usvg::text=error so the
  residual "no match" warns drop. The substitution itself works; the
  message is purely informational because Arial truly isn't installed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
funman300
2026-05-01 18:22:32 +00:00
parent 9a9026e33a
commit 78cf30e906
2 changed files with 41 additions and 1 deletions
+13
View File
@@ -100,6 +100,19 @@ fn main() {
.set(bevy::asset::AssetPlugin {
file_path: "../assets".to_string(),
..default()
})
// The bundled hayeah card SVGs declare `font-family="Arial"`
// for rank/suit text. usvg compares family names exactly,
// so on systems without Arial installed (every Linux
// distro by default) it bridges a `log::warn!` per text
// node into our tracing output — 50+ lines per game on
// launch. The substitution path in `svg_loader::shared_fontdb`
// already resolves the glyphs to whatever sans-serif the
// user does have; the warn is purely informational and
// dropping it leaves real errors visible.
.set(bevy::log::LogPlugin {
filter: format!("{},usvg::text=error", bevy::log::DEFAULT_FILTER),
..default()
}),
)
.add_plugins(AssetSourcesPlugin)