Skip to content Skip to sidebar Skip to footer

How To Use Tamil Font In Android

this is my tamil UTF-8 unicode string '\u00e0\u00ae\u009c\u00e0\u00af\u0086\u00e0\u00ae\u00a9\u00e0\u00ae\u00bf\u00e0\u00ae\u00b2\u00e0\u00ae\u00bf\u00e0\u00ae\u00af\u00e0\u00ae\u

Solution 1:

You can save the tamil (ttf) font in the assets folder, and use it like this:

TextView text; // initialize to your textviewTypefacetf= Typeface.createFromAsset(this.getAssets(),"fonts/tamil.ttf");
text.setTypeface(tf);

Solution 2:

Step 1: Download a tamil font .ttf file. (For example say kanchi.ttf).

Step 2: Now create a directory "fonts" in your assets folder in the android project.

Step 3: Now copy the kanchi.ttf file into assets/fonts folder in you Android project.

Step 4: Add these lines to your onCreate()

protectedstaticTypefacetamil=null;
tamil= Typeface.createFromAsset(getAssets(),"fonts/kanchi.ttf");

Step 5: Now provide this typeface to your TextView you want.

    textview= (TextView) findViewById(R.id.tipstext);
    textview.setTypeface(tamil);
    textview.setTextSize(20);
    textview.setText( "nkZk;");

Solution 3:

The best way to display tamil in android is to use TSCII font as described here. Unicode is not yet fully supported.

Solution 4:

if you are using webview, place the your font file 'tamilfont.ttf' in the assets folder. and the java code will be similar to this. notice the font is applied in the css

    data = "<html><head><style>@font-face {font-family: 'tamilfont';src: url('file:///android_asset/tamilfont.ttf');} h1 { font-family: 'tamilfont'; } </style></head><body><h1>தமிழன்!</h1></body></html>"; 
    WebView wv = (WebView)findViewById(R.id.webview);
    wv.loadDataWithBaseURL(null, data, "text/html", "UTF-8", null);

this approach does not work in android 2.0 and 2.1.

Solution 5:

I Have one to open Tamil font convert doc to pdf and then try to open in android phones

Post a Comment for "How To Use Tamil Font In Android"