XeTeX 泰语字符间距

XeTeX 泰语字符间距

我一直试图为泰语文档创建双栏报告样式,但很难找到文档。因此,在阅读 XeTeX 参考指南后,我们偶然发现了插入字符间的提示。

\XeTeXlinebreaklocale "th-TH"
\XeTeXlinebreakskip=0.0pt plus 0.1pt

展示我们的第一种方法也很有启发性,这种方法虽然完全失败了,但有助于说明 XeTeX 在处理泰语字符时的性质。我们尝试将泰语字母分​​为两类:一类需要在其前面留空格;另一类是“变音符号”,不需要字符间空格:

\XeTeXinterchartokenstate=1
\chardef\CharNormal=0
\newXeTeXintercharclass\CharThai
\XeTeXcharclass`ก=\CharThai  \XeTeXcharclass`ข=\CharThai
\XeTeXcharclass`ฃ=\CharThai  \XeTeXcharclass`ค=\CharThai
\XeTeXcharclass`ฅ=\CharThai  \XeTeXcharclass`ฆ=\CharThai
\XeTeXcharclass`ง=\CharThai  \XeTeXcharclass`จ=\CharThai
\XeTeXcharclass`ช=\CharThai  \XeTeXcharclass`ฌ=\CharThai
\XeTeXcharclass`ญ=\CharThai  \XeTeXcharclass`ฎ=\CharThai
\XeTeXcharclass`ฏ=\CharThai  \XeTeXcharclass`ฐ=\CharThai
\XeTeXcharclass`ฑ=\CharThai  \XeTeXcharclass`ฒ=\CharThai
\XeTeXcharclass`ณ=\CharThai  \XeTeXcharclass`ด=\CharThai
\XeTeXcharclass`ต=\CharThai  \XeTeXcharclass`ถ=\CharThai
\XeTeXcharclass`ท=\CharThai  \XeTeXcharclass`ธ=\CharThai
\XeTeXcharclass`น=\CharThai  \XeTeXcharclass`บ=\CharThai
\XeTeXcharclass`ป=\CharThai  \XeTeXcharclass`ผ=\CharThai
\XeTeXcharclass`ฝ=\CharThai  \XeTeXcharclass`พ=\CharThai
\XeTeXcharclass`ฟ=\CharThai  \XeTeXcharclass`ภ=\CharThai
\XeTeXcharclass`ม=\CharThai  \XeTeXcharclass`ย=\CharThai
\XeTeXcharclass`ร=\CharThai  \XeTeXcharclass`ล=\CharThai
\XeTeXcharclass`ว=\CharThai  \XeTeXcharclass`ศ=\CharThai
\XeTeXcharclass`ษ=\CharThai  \XeTeXcharclass`ส=\CharThai
\XeTeXcharclass`ห=\CharThai  \XeTeXcharclass`ฬ=\CharThai
\XeTeXcharclass`อ=\CharThai  \XeTeXcharclass`ะ=\CharThai
\XeTeXcharclass`า=\CharThai  \XeTeXcharclass`โ=\CharThai
\XeTeXcharclass`ไ=\CharThai  \XeTeXcharclass`ใ=\CharThai
\XeTeXinterchartoks\CharNormal\CharThai={\hskip 0pt plus 0.2pt\relax}
\XeTeXinterchartoks\CharThai\CharThai={\hskip 0pt plus 0.2pt\relax}

虽然这在每个辅音和非重叠元音前提供了字符间距,但它也破坏了连字符,因为它鼓励在每个类成员之前中断\charThai。但是,辅音和后续重叠元音之间的连字符组合得以保留。添加 \nobreak会破坏泰语字符串前的所有中断。

我们要注意的是,因为插入字符间标记会破坏对泰语连字符的支持,所以应该非常谨慎地使用(例如在ๆ 和 ฯ 周围的空格)。

相关内容