Skip to content

fix(tui/mermaid): add DejaVu/Liberation font fallback for Linux (#92)#179

Merged
quangdang46 merged 1 commit into
masterfrom
fix/mermaid-linux-font-fallback
May 22, 2026
Merged

fix(tui/mermaid): add DejaVu/Liberation font fallback for Linux (#92)#179
quangdang46 merged 1 commit into
masterfrom
fix/mermaid-linux-font-fallback

Conversation

@quangdang46
Copy link
Copy Markdown
Owner

What

Mermaid diagram labels were invisible on Linux because the terminal theme's font_family listed only Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif — none of which resolve to an installed font on most Linux desktops, so resvg fell back to a font that lacked the needed glyphs.

This addresses issue #92: #92

Changes

  • crates/jcode-tui-mermaid/src/mermaid_content.rs: append "DejaVu Sans", "Liberation Sans" to terminal_theme().font_family. Both ship with virtually every desktop Linux distribution; macOS and Windows still hit -apple-system / Segoe UI first, so the change is purely additive.

Tests

cargo fmt --check clean; cargo check -p jcode-tui-mermaid compiles.

Notes

Ports upstream PR 1jehuang#108.

The terminal mermaid theme set `font_family` to
"Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif".
On most desktop Linux distributions none of those names resolve to an
installed font (Inter is rare, ui-sans-serif/system-ui are CSS-only,
Segoe UI is Windows-only), so resvg's text rasterizer fell back to a
font that lacked the glyphs jcode actually emits in node labels —
labels rendered invisible inside the rendered PNG.

Append "DejaVu Sans" and "Liberation Sans" to the family list. Both
are part of `fonts-dejavu-core` / `fonts-liberation` which are pulled
in by virtually every desktop Linux install. macOS and Windows still
hit `-apple-system` / `Segoe UI` first, so this is purely additive.

Ports upstream PR 1jehuang#108.
Closes #92
@quangdang46 quangdang46 merged commit 15bea86 into master May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant