fix: render linked SVG badges completely - #63
Conversation
|
I simplified the font compatibility portion after reviewing its scope. The implementation now repairs only the generic This removes the heuristic scan of arbitrary loaded fonts and the unnecessary serif/monospace handling (62 lines removed net from the previous revision), while retaining the locally verified fix without hardcoded distribution-specific font names. The loaded-family check follows fontdb's exact family-name matching semantics. Revalidated with the full test suite, feature-specific checks, Clippy with warnings denied, and a manual Linux UI check of the README badges. |
Summary
.svg, such as the GitHub stars Shields endpointfontdbsans-serif alias for MIME-detected SVGs and, only when it is unavailable, resolve the concrete installed family through FontconfigProblem
The badges at the top of this repository's own README expose three related rendering failures:
Label, which moves egui's wrapped-row cursor back to the row start and makes subsequent badges overlap;.svg, although Shields dynamic endpoints correctly returnimage/svg+xml;fontdbmapssans-serifto the unavailableFreeSans, whilefc-match sans-serifresolves the installedDejaVu Sans. The GitHub badge therefore renders its shapes but dropsStarsand the count.The font issue is environment-triggered but not distro-specific: it can occur whenever the first parsed Fontconfig alias is not actually installed. A concrete reproduction and timing data were added to upstream fontdb issue #24.
The application-side resolver does not hard-code Rocky Linux font names. Existing valid aliases are preserved,
fc-matchis invoked only when the sans-serif mapping is unavailable on supported Unix targets, and its result must already exist in the loaded font database. Systems without the command retain their existing behavior.Validation
cargo test --locked— 34 passedcargo test --locked --manifest-path crates/egui_commonmark/egui_commonmark/Cargo.toml --features svg,svg_text,fetch --lib— 23 passedcargo check --locked --manifest-path crates/egui_commonmark/egui_commonmark/Cargo.toml --no-default-features --features svg,fetchcargo check --locked --manifest-path crates/egui_commonmark/egui_commonmark/Cargo.toml --no-default-features --features svg_textcargo clippy --locked --bin md-viewer --no-deps -- -D warningsStarsand its count