Skip to content

Add independent East Asian and complex-script font controls - #7

Merged
kklimuk merged 2 commits into
kklimuk:mainfrom
xsvm:fix/east-asian-font-flag
Sep 25, 2026
Merged

kklimuk merged 2 commits into
kklimuk:mainfrom
xsvm:fix/east-asian-font-flag

Conversation

@xsvm

@xsvm xsvm commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #6.

Add --font-east-asia and --font-complex-script to 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 --font behavior 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, and styles 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.
  • 1,682 non-render tests pass across 55 files on macOS ARM64.
  • Focused tests for independent font slots, seeded theme removal, flag precedence, span/range edits, batch validation, replace, styles, script-only runs, and Markdown round-trip/escaping.
  • Regenerate style-defs.docx; docx validate passes all 5 parts.
  • Build npm bundle and standalone executable; verify mixed-script edits, style readback, help, and document validation.
  • Visual verification in Word and weak-agent scenario execution.

xsvm and others added 2 commits September 9, 2026 22:22
--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
@kklimuk kklimuk changed the title Add --font-east-asia flag to set w:eastAsia independently of --font Add independent East Asian and complex-script font controls Sep 25, 2026
@kklimuk
kklimuk merged commit 584ad74 into kklimuk:main Sep 25, 2026
8 checks passed
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.

styles set/edit/create --font never sets w:eastAsia, so CJK text keeps the theme font

2 participants