1

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)

dda
  • 6,030
  • 2
  • 25
  • 34
Alok
  • 453
  • 1
  • 4
  • 17
  • Try with some other Hindi font, u can try something from http://www.wazu.jp/gallery/Fonts_Devanagari.html – the100rabh Nov 26 '12 at 17:17
  • @the100rabh I doubt the font is the problem since it works for 4.1+ – shkschneider Nov 26 '12 at 17:41
  • Can you show how to display the strings? Is it in code, xml (values-hi)?.. – shkschneider Nov 26 '12 at 17:42
  • @the100rabh I have tried some other fonts Mangal.ttf Akshar.ttf and others. But the problem is not in the font it is a known issue of glyp h rendering as explained in the issue on code.google.com. What I want to know is a feasible technical workaround for pre ics devices. – Alok Nov 26 '12 at 17:52
  • @shkschneider I have added sample strings. But the problem is well known and documented as explained on google code issue. I would want some thing that would let me render these correctly (for a webview atleast) – Alok Nov 26 '12 at 17:55
  • @Alok did u find the solution – Bipin Chandra Tripathi Mar 16 '13 at 15:30
  • @BCT Unfortunately I couldnt find a solution or a workaround for this. I had to disable the option of Hindi for Pre ICS Devices. – Alok Mar 18 '13 at 12:04
  • @Alok: Hi,I would like to support hindi language in my application.can you guide me where to start from? – Mehul Joisar Apr 17 '13 at 17:51
  • @MehulJoisar I added Unicode Hindi only for devices with Android version 4.0 or later. For previous versions I had to disable the use of Hindi. – Alok Apr 22 '13 at 11:04
  • @Alok: That is fine,but I am novice for the whole process of supporting hindi font in application.suppose I have softcopy of hindi story in word/pdf format.then `how to get its unicode` and how to display it in application without pdf reader or quick office softwares? – Mehul Joisar Apr 25 '13 at 07:15
  • @MehulJoisar The way I handled it in my app Hindu Calendar is to give an option to change the locale of the app. So once it i schanged to "hi" (hindi) it takes the resources from folder values-hi. In the xml files there the hindi text is written corresponding to the English ones. – Alok Apr 26 '13 at 10:52
  • @Alok: But how did you get hindi texts ? i.e. if u have ebook of storybook in hindi then how will u display that in your application ? – Mehul Joisar Apr 26 '13 at 10:54
  • @MehulJoisar Displaying an ebook(in pdf) is a task for a pdf renderer. What I am talking about is displaying text in TextField, or WebViews. I dont know how pdf can be shown inside an app. – Alok Apr 27 '13 at 08:58

2 Answers2

0

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);

Rndm
  • 6,710
  • 7
  • 39
  • 58
kamlesh
  • 139
  • 2
  • 13
  • Yes I considered this solution. But it will only be a solution for adding Hindi. What I needed was to implement a Android Resource based solution to implement multiple Indian languages (like Tamil) in unicode. – Alok May 03 '13 at 03:04
-1

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.

Alok
  • 453
  • 1
  • 4
  • 17