1

I am working in android. I am designing an application which shows Hindi words in text view.

I am using this code.

        String str="दिव्या";
        TextView txtview_name=(TextView)findViewById(R.id.textViewmyView);

        final Typeface customF = Typeface.createFromAsset(this.getAssets(), "Hindi-SARAL1.TTF");

       txtview_name.setTypeface(customF);

       txtview_name.setText(str);

I used font in my resourses like DroidHindi.ttf, DroidSansFallback.ttf etc. this is showing some words correctly like as समर, राजा etc , but this does not show correctly words like as दिव्या So please suggest me what .ttf i should use so each word of Hindi show correctly.

Pushpendra Kuntal
  • 6,118
  • 20
  • 69
  • 119
  • Though the thread is 2 years old, maybe [http://stackoverflow.com/questions/25188269/android-2-x-devanagari-unicode-issue](http://stackoverflow.com/questions/25188269/android-2-x-devanagari-unicode-issue) is same as this thread. – nexuscreator Aug 08 '14 at 18:10

3 Answers3

1

@Pushpendra I was having same problem with my testing device (HTC phone). But i tried same app on samsung android phone it works properly on it. So i think you should try your app on different device May be this will help you.

Manish
  • 64
  • 6
0

Instead of .ttf file, use .otf file.

Seshu Vinay
  • 13,560
  • 9
  • 60
  • 109
0

you can use Unicode instead of direct value...

String str="&# 2367;&# 2342;&# 2357;&# 2381;&# 2351;&# 2366;";

continious no gap.

TextView txtview_name=(TextView)findViewById(R.id.textViewmyView);

final Typeface customF = Typeface.createFromAsset(this.getAssets(), "Hindi-SARAL1.TTF");

txtview_name.setText(Html.fromHtml(""+str));
txtview_name.setTypeface(customF);

and you can also convert world to unicode via this site...http://mylanguages.org/converter.php but in case of दि use 1st unicode of इ then 2nd द ..b/c till android 4.0 not support proper Hindi unicode..&# 2342; is unicode of द.

kamlesh
  • 139
  • 2
  • 13