Unity3D font renderer lacks support for GPOS and GSUB. Because Thai font heavily depends on these features, rendered image looks ugly without them.
This library gives workaround to render Thai font almost correctly. Following image shows differences between results from original Unity3D and this library. Position of tone mark, upper vowel and lower vowel would be adjusted by surrounding characters.
Visit Release page to get latest ThaiFontAdjuster unity-package.
Just before setting text of UnityEngine.UI.Text, text need to be translated by
ThaiFontAdjuster.Adjust
. Font of Text should be one of supported Thai fonts.
var s = "Thai ก์กิ์ป์ปิ์ฎุญุ";
Label.text = ThaiFontAdjuster.Adjust(s);
For other UI library using Unity3D dynamic font (like NGUI), you can do it by the same way.
- Font should have extended glyphs from U+F700 to U+F71A providing various position of Thai characters.
- NECTEC National Fonts (Garuda, Loma, Kinnari, Norasi) already provide it.
- Modified NotoSansThai containing extended glyphs is included in this package.
- If you want to use another font, check it contains extended glyphs, otherwise glyphs have to be added to font by yourself.
- This library adjusts position of glyph at best with limited extended set of character. But without GPOS, ideal positioning is impossibe.
If you want to know more detail about this libary, check UnderTheHood article.