#text(tracking:1em) does not work correctly: is it feature or bug?

I found that when typing Japanese, the tracking argument of text function does not work correctly.

Example:

The code for this export is here: japanese-spacing

What happening here is that the tracking is not working between different type of characters: Kanji, Hiragana, and Katakana.

I have two questions:

  1. Is it feature or bug?
  2. If it IS bug, is there any way to avoid this?

Something strange is going on with using regex too:

#show regex("[\\p{Hiragana}\\p{Katakana}\\p{Han}]+"): it => box(stroke: 1pt, it)
ใ‚ใฎใ‚คใƒผใƒใƒˆใƒผใƒดใ‚ฉใฎใ™ใใจใŠใฃใŸ้ขจใ€ๅคใงใ‚‚ๅบ•ใซๅ†ทใŸใ•ใ‚’ใ‚‚ใค้’ใ„ใใ‚‰ใ€ใ†ใคใใ—ใ„ๆฃฎใง้ฃพใ‚‰ใ‚ŒใŸใƒขใƒชใƒผใ‚ชๅธ‚ใ€้ƒŠๅค–ใฎใŽใ‚‰ใŽใ‚‰ใฒใ‹ใ‚‹่‰ใฎๆณขใ€‚

image

Which can explain why this doesnโ€™t work perfectly:

#show regex("[\\p{Hiragana}\\p{Katakana}\\p{Han}]+"): it => it.text.clusters().join(h(1em))

ใ‚ใฎใ‚คใƒผใƒใƒˆใƒผใƒดใ‚ฉใฎใ™ใใจใŠใฃใŸ้ขจใ€ๅคใงใ‚‚ๅบ•ใซๅ†ทใŸใ•ใ‚’ใ‚‚ใค้’ใ„ใใ‚‰ใ€ใ†ใคใใ—ใ„ๆฃฎใง้ฃพใ‚‰ใ‚ŒใŸใƒขใƒชใƒผใ‚ชๅธ‚ใ€้ƒŠๅค–ใฎใŽใ‚‰ใŽใ‚‰ใฒใ‹ใ‚‹่‰ใฎๆณขใ€‚

image

I thought that something like this could work:

#set text(tracking: 1em)
#show regex("\\p{Hiragana}\\p{Katakana}"): it => it.text.clusters().join(sym.zws)

#set text(tracking: 1em)
#show regex("[\\p{Hiragana}\\p{Katakana}\\p{Han}]+"): it => it.text.clusters().join(h(1em))
1 Like