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..
An example screenshot of Kannada..
Thanks, Karthik
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...
来源:https://stackoverflow.com/questions/16455923/kannada-font-on-android-ics