tamil
tamil

Reputation: 422

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\u00be \u00e0\u00ae\u00aa\u00e0\u00af\u0081\u00e0\u00ae\u0095\u00e0\u00af\u0088\u00e0\u00ae\u00aa\u00e0\u00af\u008d\u00e0\u00ae\u00aa\u00e0\u00ae\u009f\u00e0\u00ae\u00ae\u00e0\u00af\u008d"

i want to decode it and display the tamil font

in android is this posible,how to do ?

please help me

Upvotes: 7

Views: 11739

Answers (5)

user1933789
user1933789

Reputation: 1

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

Upvotes: -1

Andro Selva
Andro Selva

Reputation: 54322

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()

protected static Typeface tamil = 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;");

Upvotes: 4

sparkymat
sparkymat

Reputation: 10028

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

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

Upvotes: 9

Kalarani
Kalarani

Reputation: 407

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

Upvotes: 3

Samuel
Samuel

Reputation: 9993

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.

Upvotes: 0

Related Questions