Tamil fonts in Android
Asked Answered
D

2

11

I developed a Tamil news application in android version 2.3.3. However, Tamil fonts have only been properly developed in android versions 4.0 and beyond. I want to display them in all versions of android mobile.

I tried to solve the problem with some Tamil fonts, such as bamini and mylai, but they only worked in higher android versions.

Desjardins answered 7/3, 2013 at 9:21 Comment(5)
I have used bamini.. It works on all version. FYI, for Android 4.1 and later, you dont need any font file. Android supports tamil by default. What problem do you have? Give me some more details. I might be able to help you.Kettle
Yes i agree with you Karthik I have used bamini font and tamil unicode converter but i will take time to display in listview.While scrolling the listview its struck @Karthik PalaniveluDesjardins
Can you please tell me which unicode support all version of android mobiles @AshwinDesjardins
I use Bamini for displaying 100s of items in a list view. I don't have any problem. And this supports all version of Android. I haven't faced a single issue till now.Kettle
yeah its working fine. i did mistake thank u very much ur respDesjardins
F
27

First of all you have to understand that there is no Tamil Language support in Android OS (except few Samsung & SE mobiles) till ICS(4.0). Even then it had bugs and full support is provided with Jelly Bean (4.2).

You will only see boxes if you use Unicode Tamil font in your app. Reason is there are no Tamil fonts in the system.

1. Manual way of doing

There is a work around for this solution. All you have to do is, download the Bamini font and place it in your assets folder. And create TypeFace with the font Bamini and set it to the TextView.

Typeface font1 = Typeface.createFromAsset(getAssets(), "fonts/Bamini.ttf");
customText1.setTypeface(font1);

Now use a converter to convert Unicode font into Bamini encoding. instead of the Unicode text provide the converted Bamini encoded script into the setText method.

2. Using the Library

If you hate all these manual encoding conversion then check out this library

As I said in above line, if you like to change the encoding dynamically while running the application then consider using the library I wrote for Android. This library will help you to convert Unicode String to Bamini, TSCII, TAB, TAM and Anjal.

Set up is very simple. All you have to do is simply import the library into your Android project and call the library as below.

// Initialise the Typeface (assumes TSCII, Bamini, Anjal, TAB or TAM font located inside assets/fonts folder)
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/mylai.ttf");
// Initialises the TextView
TextView tv = (TextView)findViewById(R.id.textView1);
//Setting the Typeface
tv.setTypeface(tf);
//Magic happens here ;) encoding conversion
String TSCIIString = TamilUtil.convertToTamil(TamilUtil.TSCII, "வணக்கம் அன்ரொயிட்");
//Setting the new string to TextView
tv.setText(TSCIIString);

There is a sample app available along with the library. Check out the app on how the library is utilised to convert the Unicode String to Bamini, TAB, TAM, TSCII and Anjal.

You would get something like this when you use the library.

Screen Shot Tamil Unicode Converter Utill

You need to make use of the TypeFace class available in Android. You can use either Bamini or TSCII encoding (Mylai is a TSCII font).

Disclaimer : I wrote this library.

3. For WebView

If you are developing using html and CSS wraped inside a WebView then take a look at this application's source. You gonna have to make use of fontface feature of CSS3.

First you need to have style declared as this

@font-face {
 font-family: MyCustomFont;
 src: url("Bamini.ttf") /* TTF file for CSS3 browsers */
}

Then you gotta use the MyCustomFont in your tags. For example if you wanna set it to the whole body (which is much easier in this case)

body {
 font-family: MyCustomFont, Verdana, Arial, sans-serif;
 font-size: medium;
 color: black
}

Hope this would give you the heads up you deserve. Hope to see more Tamil apps in Play Store.

Ferricyanide answered 19/3, 2013 at 9:52 Comment(5)
Thanks for your response i followed that library only.its working fine.Desjardins
How to display tamil font in progress dialogDesjardins
@logu applying styles are possible but I'm not sure Tamil font is possible. I'll dig further and update here if I come across any. Usually I check the SDK version and show Tamil text for ICS and above for older device only English text.Ferricyanide
how to show the tamil and english using your libaryTuque
@Tuque use non-bamini encoding. TSCII or something will do.Ferricyanide
M
-1

TAb dont need embedd, now we have unicode Please use this Tamil unicode fonts http://visualmediatech.com.fonts

Marienbad answered 8/8, 2017 at 6:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.