Thai have two challenges:
- Vowel marks will not be placed correctly
- The language has words but no spaces, which will mess up line breaks.
Vowel marks
The s-shaped glyphs above characters are not handled by the framework and will always end up one character to the right of were it should be.
I manage to hack the framework to move the carriage back on the marks.
- This is probably not recommended, but I have done a lot of testing and it runs fine so far.
- I have used AI assisted programming.
Line breaks
There is a couple of solutions to this, I use AI to put “|“ between each word and then replace it with a zero length space (don’t forget to update your line break).
//English
public override string Help_Work_Automatic => “The work is automatic”;
//Thai
public override string Help_Work_Automatic => TextLib.ThaiConv(“การ|ทำ|งาน|เป็น|ไป|โดย|อัตโนมัติ”);
public const char ZeroWidthSpaceChar = ‘\u200B’;
public static string ThaiConv(string text)
{
return text.Replace(‘|’, ZeroWidthSpaceChar);
}
Tip 1
Thai characters are more detailed and need to be about 20% larger than English.
Tip 2
Here is my font setup that covered all text so far:
<FontName>Leelawadee UI</FontName>
<Size>30</Size>
<Spacing>0</Spacing>
<UseKerning>true</UseKerning>
<Style>Regular</Style>
<CharacterRegions>
<CharacterRegion>
<Start> </Start>
<End>~</End>
</CharacterRegion>
<CharacterRegion>
<Start>฀</Start>
<End>๿</End>
</CharacterRegion>
<CharacterRegion>
<Start>​</Start>
<End>​</End>
</CharacterRegion>
<CharacterRegion>
<Start>一</Start>
<End>鿿</End>
</CharacterRegion>
<CharacterRegion>
<Start> </Start>
<End>〿</End>
</CharacterRegion>
<CharacterRegion>
<Start>＀</Start>
<End>￯</End>
</CharacterRegion>
</CharacterRegions>