Add independent East Asian and complex-script font controls - #7
Merged
Merged
Conversation
--font only ever wrote w:ascii/w:hAnsi/w:cs on <w:rFonts>, so it had no effect on CJK glyph rendering, which Word resolves through w:eastAsia (or its w:eastAsiaTheme fallback) instead. This adds a new applyRunFontEastAsia helper (set-formatting.ts, styles.tsx) plumbed through the shared RunFormat/parse-helpers pipeline so --font-east-asia works everywhere --font does: edit, edit --batch, replace, replace --batch, styles set, and styles create. Also surfaces fontEastAsia in the read --ast schema and docx styles --at --json output so the write-read loop holds, and adds unit test + fixture coverage. Fixes kklimuk#6
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.
Summary
Fixes #6.
Add
--font-east-asiaand--font-complex-scriptto set East Asian and complex-script fonts independently. Mixed-script documents can use, for example, Arial for Latin text, SimSun for Chinese, and Amiri for Arabic. The existing--fontbehavior is preserved; the complex-script override wins when both flags are supplied, regardless of argument order. Each script override clears only its matching theme-font reference.Both controls work in
edit,replace, their batch variants, andstyles set/create. Style output and AST expose the individual fonts. Run emitters and Markdown read/import preserve them, including adjacent runs with different script fonts. Update CLI help, documentation, the multilingual style fixture, and the existing resume scenario.Test plan
bun run check: lint, types, and dead-code checks.style-defs.docx;docx validatepasses all 5 parts.