Fix uneven CJK-Latin spacing in justified paragraphs#7606
Fix uneven CJK-Latin spacing in justified paragraphs#7606laurmaedje merged 1 commit intotypst:mainfrom
Conversation
|
Thanks! For the record, my understanding of what's happening here: The Extra available spacing is distributed to the right of all justifiable glyphs. Justifiable glyphs include spaces, CJ glyphs, and CJK punctuation. In Latin text, the extra spacing is thus distributed among spaces, and in CJ text, it is distributed to the right of all letters since spaces aren't usually used. However, what we really want is to distribute spacing around the inner CJK glyphs. When two CJK glyphs are next to each other, this is naturally the case since the previous one will get spacing to the right. But for Latin followed by CJK, it is not, and that's what this patch changes. The implementation seems reasonable to me as it fixes the problem and I don't see any major potential for issues arising from it (it only affects the code path where we overstretch the line and only allows spacing between Latin and CJK, which is precisely what we want). However, I think the overall implementation (not related to this PR), could probably be improved to make this a bit clearer (cf. also #7521 (comment)). |
Fixes #6062
This PR ensures that CJK-Latin spacing is applied evenly both before and after Latin glyphs when par is justified.
Previously, Latin glyphs followed by CJK characters were not marked as justifiable, leading to uneven spacing distribution.
Changes
add_cjk_latin_spacingfunction to setis_justifiabletotruefor Latin glyphs that are followed by CJ characters.Testing
before

after
