Skip to content

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

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

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

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

Source feedback: https://heygen.slack.com/archives/C0BGC335AQY/p1783969971120759

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