Automatically add spacing between CJK and Latin characters#2334
Automatically add spacing between CJK and Latin characters#2334laurmaedje merged 10 commits intotypst:mainfrom
Conversation
Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>
|
Currently, there is space processing in the preparation and in the line construction. Do both essentially do the same thing, but we need to redo it for the line because of reshaping? |
No, they are doing different things. The diff is a little hard to reason about, because it mixed some adjustments that we already have with the newly added adjustments. Currently we have following CJK-related adjustments:
In this PR, two more adjustment is added:
Note that adjustment c. and e. happens in the same place in |
|
Doesn't that mean that all adjustments that are only done in preparation are potentially lost if we need to reshape a segment containing such adjustments? |
No. There is no ligature in CJK scripts, so AFAIK its always safe to break around CJK character. So the glyphs will always be reused and no adjustment will lose. * "CJK" has multiple meanings. Here (and in typst), I am referring to the Han, Hiragana, and Katakana scripts, not Hangul. |
|
Thank you! |
Related: #276
This feature follows the Requirements for Chinese Text Layout, which adds 1/4em spacing between each Han character and a Western character.
An option
cjk-latin-spacingis added to enable users to disable this behavior. In the future, this option could accept a dimension to customize the spacing.