Skip to content

fix(fonts): subset Google Fonts to composition text#2353

Closed
miguel-heygen wants to merge 1 commit into
mainfrom
fix/google-font-text-subset
Closed

fix(fonts): subset Google Fonts to composition text#2353
miguel-heygen wants to merge 1 commit into
mainfrom
fix/google-font-text-subset

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • send the composition's unique character set through the Google Fonts text parameter
  • keep requests under a conservative URL-length limit and fall back to full unicode subsets when needed
  • add regression coverage for CJK text subsetting

Reproduction

A minimal Noto Sans JP composition on 0.7.56 fetched 1,116 font faces and took ~29.5s to compile. With this patch, the same representative CJK input fetches 9 faces in 0.57s.

Verification

  • bun test packages/producer/src/services/deterministicFonts-textSubset.test.ts packages/producer/src/services/deterministicFonts-googleSubsets.test.ts packages/producer/src/services/deterministicFonts-failClosed.test.ts (18 pass)
  • bunx oxfmt --check ...
  • bunx oxlint ...
  • bunx tsc --noEmit -p packages/producer/tsconfig.json
  • pre-commit lint/format/typecheck hooks passed

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Consolidated with the related font compilation fixes in #2406, which preserves this PR’s behavior and regression coverage.

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