You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Astro fontProviders.googleicons() experimental.glyphs not working correctly #17565
- P3: minor bugAn edge case that only affects very specific usage (priority)pkg: astroRelated to the core `astro` package (scope)triage: fix verifiedReporter confirmed the triage bot fix works
the output .woff font will contain what I believe is the entire Google Icons font including every glyph, instead of just the requested ones, as seen by analyzing the font with fontforge:
this results on a 3+ mb font file. meanwhile, if only a single glyph is on the list, like:
experimental: {
glyphs: [
"add_shopping_cart"
],
then it propertly downloads just that single one, resulting in the font file being around 3kb in my case.
What's the expected result?
When multiple glyphs are requested, only the requested glyphs should be downloaded instead of the entire glyph library, resulting in a font that is a lot smaller.
I have added a minimal reproducible example via Github since StackBlitz seems to have problems when fetching Google Icons. The only important part on my demonstration is the astro.config.mjs file.
Unit Test: Yes — packages/astro/test/units/assets/fonts/googleicons-glyphs.test.ts
Priority:P3: minor bug. This affects the experimental glyphs option for fontProviders.googleicons() only when specifying more than one glyph. A simple workaround exists (pre-joining glyph names into a single array element), and the feature itself is marked as experimental.
The root cause is an upstream bug in unifont v0.7.4 (unjs/unifont#336). The googleicons provider joins glyph names with .join(\"\") (no separator) instead of .join(\",\"), producing an invalid icon_names query parameter like \"add_shopping_cartremove_shopping_cart\". Google's API doesn't recognize the concatenated string and silently falls back to returning the entire ~3.9MB font instead of a subset.
I found a potential fix for this issue. The fix adds a workaround in Astro's googleicons() wrapper (packages/astro/src/assets/fonts/providers/index.ts) that pre-joins multiple glyphs into a single comma-separated string before passing them to unifont. This sidesteps unifont's .join(\"\") bug by ensuring it only receives a single-element array.
Try this fix
You can test this fix right now without waiting for a release:
npm i https://pkg.pr.new/astro@0a76412
If this fixes your issue, please leave a comment letting us know (e.g. "confirmed, this fixes it"). We'll then open a pull request to get this merged.
Full Triage Report
Issue Title
Astro fontProviders.googleicons() experimental.glyphs not working correctly
Issue Description
When using fontProviders.googleicons() with experimental.glyphs containing multiple glyph names, the downloaded font file contains the entire Google Icons library (~3.9MB) instead of just the requested glyphs. With a single glyph, subsetting works correctly (~2.7KB).
Reporter's Environment
Astro v7.0.7
Node v26.5.0
Linux (x64)
pnpm
Output: static
No adapter, no integrations
Reproduction Steps
Create an Astro project with the following astro.config.mjs:
This invalid value is passed as the icon_names query parameter to Google's CSS API. Google doesn't recognize it and silently returns the full font.
This was already reported upstream as unjs/unifont#336 and closed as "COMPLETED", but no new unifont version has been released with the fix.
Fix Applied
Added a workaround in Astro's googleicons() wrapper in packages/astro/src/assets/fonts/providers/index.ts. The wrapper pre-joins multiple glyphs into a single comma-separated element before passing to unifont. When unifont does .join(\"\") on the single-element array, it produces the correct comma-separated string.
Verification Results
Scenario
Before Fix
After Fix
Two glyphs
3,964,620 bytes (3.9MB) ❌
3,068 bytes (3KB) ✅
Single glyph
2,696 bytes (2.7KB) ✅
2,696 bytes (2.7KB) ✅
No glyphs (full font)
3,964,620 bytes (3.9MB) ✅
3,964,620 bytes (3.9MB) ✅
Confidence: HIGH
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
- P3: minor bugAn edge case that only affects very specific usage (priority)pkg: astroRelated to the core `astro` package (scope)triage: fix verifiedReporter confirmed the triage bot fix works
Activity
astrobot-houston commentedon Jul 31, 2026
packages/astro/test/units/assets/fonts/googleicons-glyphs.test.tsglyphsoption forfontProviders.googleicons()only when specifying more than one glyph. A simple workaround exists (pre-joining glyph names into a single array element), and the feature itself is marked as experimental.The root cause is an upstream bug in
unifontv0.7.4 (unjs/unifont#336). The googleicons provider joins glyph names with.join(\"\")(no separator) instead of.join(\",\"), producing an invalidicon_namesquery parameter like\"add_shopping_cartremove_shopping_cart\". Google's API doesn't recognize the concatenated string and silently falls back to returning the entire ~3.9MB font instead of a subset.I found a potential fix for this issue. The fix adds a workaround in Astro's
googleicons()wrapper (packages/astro/src/assets/fonts/providers/index.ts) that pre-joins multiple glyphs into a single comma-separated string before passing them to unifont. This sidesteps unifont's.join(\"\")bug by ensuring it only receives a single-element array.Try this fix
You can test this fix right now without waiting for a release:
If this fixes your issue, please leave a comment letting us know (e.g. "confirmed, this fixes it"). We'll then open a pull request to get this merged.
Full Triage Report
Issue Title
Astro fontProviders.googleicons() experimental.glyphs not working correctly
Issue Description
When using
fontProviders.googleicons()withexperimental.glyphscontaining multiple glyph names, the downloaded font file contains the entire Google Icons library (~3.9MB) instead of just the requested glyphs. With a single glyph, subsetting works correctly (~2.7KB).Reporter's Environment
Reproduction Steps
astro.config.mjs:astro builddist/_astro/fonts/Expected Result
The font file should contain only the two requested glyphs, resulting in a small file (a few KB).
Actual Result
The font file is ~3.9MB, containing the entire Google Icons library.
Reproduction Evidence
Root Cause
The bug is in the unifont package (v0.7.4), Astro's upstream dependency for font resolution.
In unifont's googleicons provider (
src/providers/googleicons.ts):The
.join(\"\")concatenates icon names without any separator:[\"add_shopping_cart\"]→\"add_shopping_cart\"✅[\"add_shopping_cart\", \"remove_shopping_cart\"]→\"add_shopping_cartremove_shopping_cart\"❌This invalid value is passed as the
icon_namesquery parameter to Google's CSS API. Google doesn't recognize it and silently returns the full font.This was already reported upstream as unjs/unifont#336 and closed as "COMPLETED", but no new unifont version has been released with the fix.
Fix Applied
Added a workaround in Astro's
googleicons()wrapper inpackages/astro/src/assets/fonts/providers/index.ts. The wrapper pre-joins multiple glyphs into a single comma-separated element before passing to unifont. When unifont does.join(\"\")on the single-element array, it produces the correct comma-separated string.Verification Results
Confidence: HIGH
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
keratomalaciant commentedon Jul 31, 2026
Yep, the fix works correctly, and now only the requested glyphs are properly downloaded instead of the entire Google Icons collection.
astrobot-houston commentedon Aug 1, 2026
The fix has been verified! A pull request has been created: #17566
Fix googleicons provider returning full font when multiple glyphs are…