mirror of
https://github.com/penpot/penpot.git
synced 2026-11-06 10:00:38 +00:00
Horizontal Japanese justification spread each line's slack evenly over all character gaps, while vertical columns widen gaps in JLREQ pair-table order. Squeezing also differed: horizontal squeezed only under push-in first, while vertical also squeezes under push-out first when push-out cannot resolve a kinsoku break. Move the axis-free part of the vertical allocator into text_allocation: jlreq_expansion_gap classifies a gap from the pair table and jlreq_ordered_expansion widens word spaces, then Japanese/Western gaps, then solid kana and kanji, then spreads any rest. Vertical columns and horizontal lines both use it. Horizontal collects real characters from the laid-out lines; inserted joiners and spacing belong to the gap between their neighbours. The last line, distribution and the warichu, joiner and Western-word skips stay as they were. Under push-out first, horizontal now squeezes a line when the break would move back over more than MAX_KINSOKU_SHIFT kinsoku pairs, the limit vertical oidashi uses, now shared from jlreq. A cheap scan for such runs gates the pass, so other text keeps its layout cost. Push-out only never squeezes. This changes existing horizontal justified Japanese layouts on purpose: punctuation aki and gaps beside ruby bases no longer widen, and a line with no expandable gap stays short, as vertical columns do. No existing test needed changes beyond the new line adjustment argument. AI-assisted-by: claude-opus-5-5