5

I am supporting Tamil and Kannada fonts in my application. I use the following code to set the typeface of TextViews, Buttons, etc

FONT_TAMIL = Typeface.createFromAsset(getAssets(), "fonts/tamil.ttf");
tvTitle.setTypeface(FONT_TAMIL);

FONT_KANNADA = Typeface.createFromAsset(getAssets(), "fonts/kannada.ttf");
tvTitle.setTypeface(FONT_KANNADA);

I am able to display Tamil characters properly even on GingerBread. But I am not able to show the Kannada font. Can anyone please help me to find where I am going wrong?

An example screenshot of Tamil.. Tamil

An example screenshot of Kannada.. Kannada

Thanks, Karthik

Cœur
  • 37,241
  • 25
  • 195
  • 267
Karthik Andhamil
  • 848
  • 1
  • 13
  • 22

1 Answers1

1

Did you tried replaceAll function to replace each and every Unicode characters to Ascii? You can use Character Map tool in Windows to get the equivalent ASCII characters for each of your Kannada/Tamil characters.

1) First you install both Unicode and Kannada font in your PC.

2) Then open two windows of character map tool.Select Unicode font in first window and Ascii in second one.

3) In both windows, double click the desired characters (same character in both windows).So the character will be displayed in the textbox.Copy that character from both windows and add them to replaceAll function.

Its takes long to copy each and every characters and character combinations.But I dont think there is another method to display unicode properly below ICS version.You need to convert it.And ofcourse hardwork leads to success :) Best wishes bro...

Basim Sherif
  • 5,384
  • 7
  • 48
  • 90
  • Can you please explain it a bit more how to use character map tool? – Karthik Andhamil May 10 '13 at 23:51
  • Hi, Am really sorry for bugging you Basim. Please clarify this doubt. The tool shows Kannada characters when i select "BRH Kannada" but I guess those characters are just raw characters. I know only tamil. So, for example, the tools shows Oo (ஊ) and Ka (க) but not Koo (கூ). But I need to replace Koo with some ASCII characters I guess. Do you understand what I am saying? Please ping me endless.karthikp@gmail.com – Karthik Andhamil May 13 '13 at 21:12
  • 1
    For Koo, try the combinations of Ka and Oo. means, ka+Oo (without + symbol).Then you will get the correct combinations of characters for the word Koo.Similiarly for the combination, Kee try the combination of Ka and Ee (Ka+Ee). When you select a Kannada Unicode font make sure that it contain all the characters and combinations.If its not, try another Kannada unicode font. – Basim Sherif May 14 '13 at 04:05