Correcting Hindi (Unicode) rendering in Android

非 Y 不嫁゛ 提交于 2019-12-09 02:07:24

问题


I successfully added a custom typeface (DroidSansFallBack.ttf) to show Hindi characters instead of Blocks on Pre ICS . All is working well on 4.1+ in any case.

But the rendering order is wrong on Froyo and Gingerbread. I understand it is not resolved http://code.google.com/p/android/issues/detail?id=4153

What are the possible workarounds to correct the rendering? (I don't want to use images )

EDIT: Example,

दिन string from values-hi renders as दनि

नक्षत्र renders as नक् ष त र

(On 4.1+ everything renders correctly)


回答1:


I have a alternative solution for your problem but not exact... use font....

Typeface tf = Typeface.createFromAsset(getAssets(),"Hindi-SARAL1.TTF"); 

for नक्षत्र use .......

 TextView tv = (TextView) findViewById(R.id.textView1);

tv.setText("n95"); 

tv.setTypeface(tf);

and for दिन........ unicode value continues no gap.. i have given a space between &# and 2367;

tv.setText(Html.fromHtml("&# 2367;&# 2342;&# 2344;"));

 tv.setTypeface(tf);




回答2:


I could not find a simple work around for fixing the rendering everywhere. So finally I had to limit the Hindi language feature to devices having android version 4.0 or later.



来源:https://stackoverflow.com/questions/13569698/correcting-hindi-unicode-rendering-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!