Unable to see indian language characters even in android 2.3

自古美人都是妖i 提交于 2020-01-24 19:31:30

问题


I set String myText="\u2327\u2381\u2352\"; and try to display it in a Textview but I just see 3 rectangular boxes in the android emulator. Even though android 2.3 release note says that hindi is supported I still do not see hindi character appearing in the emulator.


回答1:


Even if you have a Devanagari font installed you don't get proper rendering for Hindi text on Android phones.

The same apples to all complex Indic scripts (Bangla, Devanagari, Kannada, Tamil, Telegu, Tibetan, Punjabi, Sinhala, etc)

The problem is that, although Android "supports Unicode" there is no complex script rendering support - even in the Andoid 4.0 (ICS) emulator. Due to this letters don't join up to form conjuncts properly and so the text is pretty well unreadable.

Until Google fixes this Indian languages won't display properly.

This would actually not be very difficult for them to fix. In Linux (which Android is based on) complex text rendering for Indic scripts is supported by library known as Pango or Harfbuzz which is open source - but for some reason (lack of real interest in the Indian and South Asian market?) Google chose not to implement this in Android.

Indic scripts work fine on phones which use other Linux based operating systems such as Nokia's N900. Even some Symbian phones can display Indic text through the support in Qt.
Apple iPhone's now also display Indian languages properly.

If Google and their OEMs care about selling Android phones in India they really need to fix this defect urgently.




回答2:


Indian Languages aren't currently supported in many devices, and including the emulator too.

Only Samsung devices being sold in India are supporting Hindi.

You're not alone with this problem mate! :-)




回答3:


Android phones do not come with default hindi fault .

You have to make sure that you are using a custom Hindi Font.

Create a folder called fonts in your assests folder.

Put your custom_font_hindi.ttf in the assets/fonts.

 Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/custom_font_hindi.ttf");
        TextView tv = (TextView) findViewById(R.id.CustomFontText);
        tv.setTypeface(tf);

Then you will see the desired hindi font in your TextView




回答4:


You can use DroidHindi.ttf font (for example. Search in google.com). Add it to assets folder in your project and load that font in your Views.

Typeface t = Typeface.createFromAsset(getContext().getAssets(), "DroidHindi.ttf");
textView.setTypeface(t);



回答5:


I have Samsung Galaxy S. I have installed DDJV6 using Kies over JP6. But I am feeling absolutely cheated by Samsung as this so called 'Indian Release' does not support any Hindi or Indic fonts. I am talking about reading Hindi text. As far as text input is concerned, Hindi is not even shown as a data input language. Shame on Samsung that it cannot use the inherent features of Gingerbread! I am saying so because even Froyo Official release of Galaxy S in India could render Hindi fonts correctly. There were a lot of tall claims that Gingerbread would support 52 languages (both for reading and writing) and here is this Samsung that it can't even render Indic reading capabilities in Galaxy S based on Android 2.3.3.




回答6:


Looks like a font problem, try to set your TextView to use a font with suitable glyphs.




回答7:


I have found the solution for How to use hindi font use in Android. It is very simple solution. But hard to right Hindi font.

use

DroidHindi.ttf

it is the font which support for Hindi Language.

Download it and place in Assets folder. Do the following code to set the font:

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

Typeface fontHindi = Typeface.createFromAsset(getAssets(),    "fonts/DroidHindi.ttf");      

tv.setTypeface(fontHindi);

Now you can find your solution easily.

Moreover you can put the Hindi text in .txt file and read from that also. Like this.

Place your all the hindi .txt files in Assets folder and call the function to retrieve Hindi text like:

public void readData(int tag) {


        // file to inputstream
        InputStream input = null;
        try { 

             int tagV = tag +1;

             input = ctx.getAssets().open("sample "+tagV+".txt");

             int size = input.available();
             byte[] buffer = new byte[size];
             input.read(buffer);
             input.close();

            // byte buffer into a string

             detailtext = new String(buffer);
         } catch (IOException e) {

             e.printStackTrace();
         }

     }

I am using 15 files here so i undergo the loop.



来源:https://stackoverflow.com/questions/4779162/unable-to-see-indian-language-characters-even-in-android-2-3

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