Commit graph

4 commits

Author SHA1 Message Date
Ryo
0abd934046 fix: make CJK font conditional and locale-aware
Address code review feedback from cubic-dev-ai:

P1: Unconditionally passing CJKmainfont broke non-CJK conversions in
environments without CJK fonts. Now the source file is scanned for CJK
characters and the font argument is only added when CJK content is
detected.

P2: Hardcoded Noto Sans CJK SC only covers Simplified Chinese. Now
detects the specific CJK language (Japanese Kana, Korean Hangul, or
Chinese Hanzi) and selects the appropriate font variant (JP/KR/SC).

Changes:
- Add detectCJKFont() that reads the source file and returns the
  correct Noto Sans CJK variant, or null for non-CJK content
- CJK font argument is only added when detectCJKFont returns non-null
- Detection order: Japanese (Kana) > Korean (Hangul) > Chinese (Hanzi)
  since Japanese also uses Kanji shared with Chinese
- Graceful fallback: if file can't be read, no CJK font is added
- Update tests to use temp files with real CJK content (11 tests total)
2026-07-02 10:23:16 +08:00
Ryo
143ade3d36 fix: add CJK font support for PDF conversion
When converting documents containing Chinese, Japanese, or Korean
characters to PDF via pandoc/xelatex, the output was blank or missing
glyphs because no CJK-capable font was installed or configured.

Changes:
- Dockerfile: Add fonts-noto-cjk and texlive-lang-chinese packages
- pandoc.ts: Pass -V CJKmainfont=Noto Sans CJK SC to pandoc when
  converting to pdf/latex, so xelatex uses a CJK-capable font
- pandoc.test.ts: Add 3 tests verifying CJK font argument is present
  for pdf/latex output and absent for other formats

Fixes #547
2026-07-02 09:55:01 +08:00
Jörg Krzeslak
826dc1062a test: add awaits to rejects and resolves 2025-12-14 02:57:00 +01:00
Jörg Krzeslak
84d7da0195 test: add tests for dasel, pandoc and vtracer 2025-12-14 02:57:00 +01:00