问题
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