fix(ui): bundle Material Symbols icon font locally instead of Google Fonts CDN#336
Merged
Conversation
…Fonts CDN The login/QR/region pages render icons via `.material-symbols-outlined` font ligatures, but the font was loaded from fonts.googleapis.com. On machines that are offline — or on the TW/HK networks this launcher targets, where Google Fonts is often slow/blocked — the font never loaded and the icons fell back to raw ligature text (qr_code_2, passkey, expand_more, ...). Bundle the font in-app: add the `material-symbols` package, import its `outlined.css` (ships the woff2 + the `.material-symbols-outlined` class) from src/main.ts, and drop the CDN <link> from index.html. Icons now resolve offline. Adds ~3.8 MB (one outlined woff2) to the bundle.
Follow-up to bundling the icon font: instead of shipping the full ~3.8 MB Material Symbols Outlined woff2, bundle a subset of only the ~11 icons the app actually renders (login / QR / region-picker pages), cutting the in-bundle font to ~10 KB. - Add scripts/subset-material-symbols.py, which strips GSUB down to the icons' ligatures then subsets with layout closure (the `--text` closure alone over-includes because the icon names span most of the alphabet). - Ship the subset at src/assets/fonts/ and load it via a local src/styles/material-symbols.css `@font-face` + the `.material-symbols-outlined` class (mirrors the upstream CSS; icons render via the font's rlig ligatures). - main.ts imports the local CSS instead of `material-symbols/outlined.css`. - Move `material-symbols` to devDependencies (now only the subset source). Verified in a Chromium render: all 11 icons shape to a single glyph (24px), no text fallback. Build emits only the ~10 KB woff2; the 3.8 MB font is no longer bundled.
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.
What
The login page (and the QR / region-picker pages) render UI icons via
.material-symbols-outlinedfont ligatures. The Material Symbols font was loadedfrom
fonts.googleapis.com(a<link>inindex.html). On machines that areoffline — or on the TW/HK networks this launcher targets, where Google Fonts is
often slow or blocked — the font never loaded, so the ligatures fell back to raw
text (e.g. the QR / GamePass switch buttons showed
qr_code_2/passkey).Fix
Bundle the font locally instead of relying on the CDN, subset to just the icons
we use:
scripts/subset-material-symbols.py, which produces a ~10 KB subset of the~11 icons the app renders (it strips GSUB down to those ligatures, then subsets
with layout closure —
--textclosure alone over-includes because the iconnames collectively span most of the alphabet).
src/assets/fonts/and load it via a localsrc/styles/material-symbols.css@font-face+.material-symbols-outlinedclass;
src/main.tsimports it. Remove thefonts.googleapis.com<link>from
index.html.material-symbolsbecomes a devDependency (the full-font source for the subsetscript only — not bundled at runtime).
Icons resolve offline; the in-bundle font is ~10 KB (down from the ~3.8 MB full
face). Verified in a Chromium render that all 11 icons shape to a single glyph
with no text fallback; prettier / eslint / vue-tsc / vitest (629 tests) all pass.