fix: cover CJK transcripts instead of rendering tofu - #11
Open
natyang1234 wants to merge 1 commit into
Open
Conversation
Every library recipe declares a Latin webfont stack (Archivo, Playfair, ...) with Latin system tails, and the engine resolves only the webfonts it fetches - there is no per-glyph system-font fallback. A Chinese, Japanese or Korean transcript therefore renders as tofu boxes on every caption, and probe-qa cannot tell: tofu has ink and contrast. Found on the first real Chinese video this pipeline was given (a zh-TW birthday clip through the custom whisper provider): every caption drew as empty rectangles while all gates reported clean. generate-recipe now runs a deterministic font-coverage pass inside the one writer of the final document. When the transcript contains CJK and the document's font stacks name no covering family, the matching Noto family (TC / JP / KR by script; Han without kana or hangul defaults to Traditional) is added to the existing Google Fonts css2 request and appended to each font-family list ahead of the generic keyword - so the recipe's webfonts keep styling Latin and the Noto face catches only the glyphs they lack. A Latin transcript, or a recipe that already names a covering family, passes through byte-identical, keeping recipe runs deterministic for the content they were authored against. Verified end to end: the same run renders tofu before and correct Traditional Chinese after, with lint and probe-qa clean; unit tests cover script detection, URL extension, stack placement, the serif/sans split, and the byte-identical pass-throughs. Run: node --import tsx --test tests/ensure-font-coverage.test.ts
jakubtyrcha
reviewed
Aug 11, 2026
jakubtyrcha
left a comment
There was a problem hiding this comment.
Thanks for the contribution. We plan to address fallback fonts in the coming weeks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The defect
Every library recipe declares a Latin webfont stack (Archivo, Playfair Display, …) with Latin system tails, and the engine resolves only the webfonts it fetches — there is no per-glyph system-font fallback. A Chinese, Japanese or Korean transcript therefore renders as tofu boxes on every caption, and probe-qa cannot tell: tofu has ink and contrast.
Found on the first real Chinese video this pipeline was given — a zh-TW birthday clip through the
customwhisper provider (mlx-whisper JSON). Every caption drew as empty rectangles while lint,--verifyand probe-qa all reported clean.The fix
generate-recipe.tsnow runs a deterministic font-coverage pass inside the one writer of the final document (pipeline/scripts/ensure-font-coverage.ts):font-familylist ahead of the generic keyword — the recipe's webfonts keep styling Latin, the Noto face catches only the glyphs they lack;Verification
hook-107-peak, zh-TW transcript): tofu before, correct Traditional Chinese after; lint +--verify+ probe-qa clean (0 warn).node --import tsx --test tests/ensure-font-coverage.test.ts, 8 passing) cover script detection, css2 URL extension, stack placement before the generic keyword, the serif/sans split, already-covered pass-through, no-link documents, and the Latin byte-identical guarantee.Notes for reviewers
--modulecopy) that names its own CJK family always wins, so an SC-preferring deployment can override per recipe.🤖 Generated with Claude Code