#2076

pptx: Japanese decks break kinsoku (punctuation at line start) because pptxgenjs defaults to lang en-US

Openhaihan19955opened 5d ago

Summary

Japanese decks created with the pptx skill wrap with punctuation at the start of lines (、 。 ) ー) and opening brackets at the end of lines. The cause is that the skill builds decks with pptxgenjs, which writes lang="en-US" on every run unless lang is passed. PowerPoint only applies Japanese line-breaking rules (kinsoku) to runs tagged with a Japanese locale.

Nothing in skills/pptx/SKILL.md currently mentions lang, so Claude follows the defaults and every Japanese deck is affected.

Repro

pptxgenjs 4.0.1, PowerPoint for Microsoft 365 on Windows. Same text and same box; only lang differs. Line breaks were read back from PowerPoint via COM (TextRange.Paragraphs(1).Lines(n)).

slide.addText("デジタルトランスフォーメーションの推進には、経営層のコミットメントが不可欠である",
  { x: 0.5, y: 0.5, w: 3.7, h: 1.5, fontFace: "Meiryo", fontSize: 12 /*, lang: "ja-JP" */ });
langLine 1Line 2
default (en-US)デジタルトランスフォーメーションの推進には、経営層のコミットメントが不可欠である
ja-JPデジタルトランスフォーメーションの推進には、経営層のコミットメントが不可欠である

Across 600 generated text boxes (random business sentences, widths, Meiryo / Yu Gothic / BIZ UDPGothic, 12–18pt), there were 67 line-start kinsoku violations with the default and 0 with lang: "ja-JP".

One more trap: a table-level lang passed to addTable() does not reach the cells. Each cell needs lang in its own options. I reported both pptxgenjs points upstream in gitbrent/PptxGenJS#1544.

Suggested change

Add one bullet to "Creating with pptxgenjs — gotchas" in skills/pptx/SKILL.md, for example:

  • CJK text needs lang. pptxgenjs tags every run lang="en-US", and PowerPoint applies East Asian line-breaking (no 、 / ) at line start) only to runs tagged with the matching locale. Pass lang: "ja-JP" (or zh-CN, ko-KR) on every addText() call and in each table cell's options; a table-level lang is not applied to cells.

I tested this with Japanese only. I'd expect Chinese and Korean to behave the same way, but I haven't verified them.

The 600-box test corpus and the scripts that read line breaks back from PowerPoint are in https://github.com/haihan19955/jp-business-slides (tests/wrap_corpus.js, skills/japanese-business-slides/scripts/export_layout.ps1), in case they're useful for verifying.

Activity

0

No activity yet.