2

I have developed Android applications before. I plan to write an Android application that will support the gujarati language with Unicode. http://developer.android.com/index.html does not provide any hint on the topic. The android.textview class does not contain a language option for languages, does adding fonts in the asset directory help?

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
jzyamateur
  • 113
  • 9

1 Answers1

1

Yes you can set custom font to the TextView.


Assuming you have a gujarati.ttf font in fonts folder under assets folder:

Code for setting custom font to TextView:

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

It enables gujarati only for the TextView for which you have set the font, but if you want to show gujarati system wide then you need to know:

Whenever android fails to find a specific character it looks to DroidSansFallback.ttf, so what you need to do is replace the DroidSansFallback.ttf of the emulator/mobile by renaming a gujarati ttf font to DroidSansFallback.ttf


Here is the process if you want to install gujarati font in android emulator.

Community
  • 1
  • 1
Imran Rana
  • 11,899
  • 7
  • 45
  • 51