tamil unicode font text scrambles/broken in androi

2019-08-03 02:27发布

问题:

i need to use unicode font in android instead of bamini. I don't want to use script to convert to & from bamini to unicode.

Typeface fontface2 = Typeface.createFromAsset(this.getAssets(), "fonts/Lohit-Tamil-Classical.ttf");
playBtn.setTypeface(fontface2);
//playBtn.setText(UnicodeUtil.unicode2tsc(getContext().getString(R.string.QUIZ)));
playBtn.setText(Html.fromHtml(getContext().getString(R.string.QUIZ)));

it render tamil but the characters are scrambled. Please help to fix.

Thanks

Mahir

回答1:

If the phone doesn't support Unicode Tamil (before ICS aka 4.0) then you can't display Unicode scripts. Basically utill Jelly Bean, Android doesn't have proper Tamil rendering support (even though first it made available in 4.0). So basically no matter what Unicode font you use, Android OS doesn't know how to shape it up and show it.

That's why people use TypeFace and non unicode fonts such as Bamini and Mylai (TSCII font).

Read my elaborative answer and solutions here