Monday, 18 February 2013

How To Use Various Font(like Marathi) In Your App

Android doesn't support various fonts like Marathi so this tutorial gives you idea about how to use various font like Marathi in your app.So you can display your data in various languages using the font combination in your app.

Step1)First you have to download the .ttf file like (akshar.ttf for marathi font) which will be used for converting your text according to this font.

Step2)After Downloading this file,You have to copy this file and paste in your asset folder.

Step3)Suppose you take a text view to display to your data which is stored in your string.xml,then you have to write this following code for displaying this data with this font format.

           a)  TextView  t1 = (TextView) findViewById(R.id.t1); 

           b)  Typeface tf = Typeface.createFromAsset(getAssets(), "akshar.ttf");
                  t1.setTypeface(tf, Typeface.BOLD);


 Step4)Next,You have to write this following in your XML.   
       
                  <TextView
                    android:id="@+id/t1"
                   android:layout_width="fill_parent"
                   android:layout_height="fill_parent"
                   android:text="@string/sindhu"
                   android:textColor="#000000"
                   android:textSize="6pt" />


Step5)Then you write you string.xml with the following.
              
             <string name="sindhu">सिंधुदुर्ग जिल्हा हा १५.३७ आणि १६.४० उत्तर अक्षवृत्त व ७३.१९ आणि     ७४.१८  पूर्व रेखावृत्त या दरम्यान वसलेला आहे. 

Thank u....
 

8 comments:

  1. Thank you sir... Shailesh Vishwase

    ReplyDelete
  2. nice post...where can i download ttf file...plz reply

    ReplyDelete
  3. how to type in marathi in XML or which font family is supported for xml.

    ReplyDelete
  4. @learning c:plz look into this for .ttf file to download:
    http://www.findthatfonts.com/search-9348-hTTF/fonts-download-search-engine-akshar.ttf.htm

    ReplyDelete
  5. text exceeds then one line not getting wrap to next line going beyond the screen.

    ReplyDelete
  6. How to use txt or rtf file instead of using it in string.xml.

    by using you code it not comes properly. it shows me /u2345 /u5647 ... like o/p

    thanks in advanced

    ReplyDelete
  7. how to type in marathi ,plz let me know as this is very urgent for my live project

    ReplyDelete
  8. Marathi language support from 4.0 and you have put this marathi strings in string.xml file.To type in marathi you have to refer this site....http://www.quillpad.in/index.html#.Uxf_wj-1YUo

    ReplyDelete

 

Copyright © Unique Android Tutorial.. Design by Free CSS Templates | Blogger Theme by BTDesigner | Powered by Blogger