fix: use resolvable font stack in diagram SVGs - #1628
Merged
Conversation
Both diagrams requested `Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif`. Inter is not bundled, and an SVG loaded through <img> cannot use the site's webfonts, so resolution fell through to the system-font aliases: `ui-sans-serif` is not a supported generic in Firefox, and `-apple-system`/`BlinkMacSystemFont` point at the macOS system font, which Firefox has historically had trouble accessing. That produced garbled glyphs in the diagram labels in Firefox. Replace the aliases with real font files that exist on every platform. Rendering is unchanged where the old stack already worked -- the Firefox render of async-update-timeline.svg is byte-identical before and after. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
✅ Deploy Preview for solid-docs-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The diagram labels on
/concepts/async-reactivityrender as garbled glyphs in Firefox.Both diagram SVGs declare:
Inter is not bundled with the repo, and an SVG loaded through
<img>cannot use the page's webfonts — it can only use locally installed fonts. So resolution falls through to the system-font aliases, and every one of them is fragile:ui-sans-serifis not a supported generic family in Firefox-apple-system/BlinkMacSystemFontpoint at the macOS system font, which Firefox has historically had trouble accessing correctlyFix
Replace the aliases with real font files that exist on every platform:
Applied to both
async-update-timeline.svgandderived-state-effects-sequence.svg.Verification
Rendered both SVGs in Firefox (headless, clean profile) before and after. The
async-update-timeline.svgrender is byte-identical across the change (85,729 bytes), confirming a healthy Firefox was already falling through to Helvetica — this only removes the ambiguity so it cannot land on a broken alias instead. No visual change on Chromium either.Scope
I audited all 30 SVGs in the repo. These two were the only ones affected:
font-familypublic/images/diagrams/Helvetica, Segoe UI EmojiNote
I was not able to reproduce the garbled rendering in a clean Firefox profile, so this is a fix for the most plausible cause rather than a confirmed repro. It is a strict robustness improvement regardless: the previous stack's behavior depended on browser-specific system-font alias handling, and the new one does not.
🤖 Generated with Claude Code