Skip to content

fix(producer): skip slow TTC recompression#2322

Open
miguel-heygen wants to merge 1 commit into
mainfrom
fix/ttc-font-compile-latency
Open

fix(producer): skip slow TTC recompression#2322
miguel-heygen wants to merge 1 commit into
mainfrom
fix/ttc-font-compile-latency

Conversation

@miguel-heygen

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

Copy link
Copy Markdown
Collaborator

What

Skip wawoff2 recompression for TTC font collections and embed them as raw font/collection data URIs with the matching CSS format(collection) hint.

Why

A reported 120-second talking-head package spent about six extra minutes compiling a TTC font. Reproduction with a 19 MB Noto Sans CJK collection took 57.73 seconds and about 320 MB RSS in fontToDataUri alone. Chromium also rejects a raw collection when it is mislabeled as format(woff2).

How

  • Return TTC buffers directly as font/collection instead of attempting whole-collection WOFF2 compression.
  • Select format(collection) for collection data URIs while preserving format(woff2) everywhere else.
  • Add regression coverage for the no-compression path and CSS format selection.

The same real TTC now embeds in 0.07 seconds with the correct data URI prefix.

Test plan

  • 37 focused deterministic-font and compression tests pass
  • Producer typecheck
  • Formatting check on the four changed files
  • Pre-commit lint, format, fallow, tracked-artifact, and typecheck hooks
  • Real 19 MB NotoSansCJK-Regular.ttc benchmark: 57.73s before, 0.07s after
  • Chromium validation: raw font/collection with format(collection) loads; format(woff2) does not
  • Independent review: no findings

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