Question

A short preface. Thai script has vowel signs that may appear above the consonants, and also there are diacritic signs (DS) that also appear above the consonants; when both vowel and DS present, they appear one above other, so the vowel is set above the consonant and the DS is set above the vowel.

I am writing an application that will display text in Thai. Everything looks perfect in the emulator (API 10) but not on the real device (Samsung GT-I9001 with Gingerbread 2.3.6).

I've prepared two pictures to illustrate the problem. I have a simple layout that has the only TextView at the top; two words พี่สาว and ไม้ are displayed in that view.

This is how it should look like (a screenshot from the emulator):

enter image description here

The first character has a vowel and a DS above the vowel, and the last character has the DS only.

And here is a screenshot from my phone:

enter image description here

Both DS have slid down and now the vowel and the DS overlap each other above the first character. Note that the last by one character appears lower than it should (it should be whole line tall like you may see on the first screenshot).

I've found that the problem is system-wide: I've copied these Thai words to a simple web page and loaded it in the web browser in my phone, and got the same problem. It seems like the font rendering is broken.

So the question: how to bypass this? Do I need to install fonts (how?) or maybe some language pack (again, how?), or the only way is upgrading the Android?

PS: no problem on Android 4.0.4. Perhaps only old versions are affected.

Update: WarrenFaith has given a promising advice about setting the custom font. However this appeared to be not as simple as it looks. I've tried several different fonts including Roboto (introduced in ICS), Verdana from the msttf Linux package, and some others. To see that the font is really loaded and applied, I've added some Latin and Cyrillic characters to my text.

The result is funny. Only the Latin and Cyrillic characters change, but not Thai ones. Looks like the fonts don't have the required glyphs and Android replaces them with ones rendered using some default font.

(I don't understand why Roboto didn't work; it's the official Android font—shouldn't it have full support for the whole Unicode?)

So it seems like I have to find the font that has Thai glyphs.

And I'm still wondering what font is used by default in Android 4.0.4.

Happy end: thanks to WarrenFaith's advice, Google, and this blog article.

Was it helpful?

Solution

If the default text/font is broken, you should provide a font you know that will work. To implement the font, you can use the following answers:

  1. Android - Using Custom Font
  2. Using a custom typeface in Android
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top