Skip to content

Conversation

@harlan-zw
Copy link
Collaborator

@harlan-zw harlan-zw commented Jan 30, 2026

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Google Fonts unicode-range subsetting caused issues with Satori - non-Latin subsets would get loaded but lack glyphs for Latin text. WOFF2 variable fonts also don't work since Satori doesn't support font variation axes.

This extracts unicode-range from font-face blocks and passes it through to Satori for proper glyph selection (falling back to Latin range if missing). It prefers static WOFF over variable WOFF2 when both are available, and converts WOFF2β†’TTF using wawoff2 for all subsets. Converted fonts write directly to @nuxt/fonts cache directory for unified publicAssets bundling.

- Filter to Latin-only unicode-range subsets to avoid tofu
- Prefer WOFF over WOFF2 (static fonts work directly with Satori)
- Convert WOFF2β†’TTF using wawoff2 when no WOFF fallback exists
- Write converted fonts to @nuxt/fonts cache for unified output
- Warn when variable fonts detected (Satori doesn't support weight axes)
Instead of filtering to Latin-only subsets, extract and pass through
the unicode-range from @font-face blocks. This lets Satori pick the
right font for each character. Falls back to Latin range if missing.
Variable fonts converted from WOFF2 have fvar tables that crash
opentype.js when parsed. This change:

1. Deletes variable font TTFs after conversion instead of keeping them
2. Checks cached TTFs for variable font markers and deletes if found
3. Suppresses 404 warnings for intentionally deleted TTF files

Satori falls back to WOFF fonts which work correctly.
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.

2 participants