0

i am developing new android application...i tried load html content in webview in 2.2 emulator but not supporting tamil font

here my code...

WebView learn2crack = (WebView)findViewById(R.id.webview);
learn2crack.getSettings().setDefaultTextEncodingName("utf-8");
learn2crack.getSettings().setJavaScriptEnabled(true);
learn2crack.loadUrl("http://www.dinamalar.com/");

thanks in advance

Squonk
  • 48,735
  • 19
  • 103
  • 135
user3008032
  • 112
  • 12
  • 1
    Sorry this is not a solution to your problem and I'm not even sure there is a workaround but a lot of fonts / character sets weren't supported in older versions of Android. – Squonk Dec 06 '13 at 10:57
  • You could try the link in the answer here http://stackoverflow.com/questions/6319405/any-reference-for-a-good-free-tamil-font-for-android-app?rq=1 – Squonk Dec 06 '13 at 11:02
  • Thanks for your link,but that's not for webview – user3008032 Dec 06 '13 at 11:51
  • finally i solved the issue for android lower version – user3008032 Dec 10 '13 at 14:01

1 Answers1

0
Typeface tf = Typeface.createFromAsset(getAssets(), "Bamini.ttf");    
    String tamil_string="செய்திகள்";
    //creating intance of TamilFotnUtil Class
    TamilFontUtil tfUtil = new TamilFontUtil();

   //Convert Tamil font encording using the utility.
    String tamilStringEncoded =  tfUtil.convertTamilString(tamil_string);

add below line inside the the style

@font-face {font-family: MyCustomFont; src: url("Bamini.ttf")}body {font-family: MyCustomFont, Verdana, Arial, sans-serif; font-size: medium; color: black}"

for example

<html> <head>

 <title>example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

 <style type="text/css">@font-face {font-family: MyCustomFont; src: 

url(file:///android_asset/Bamini.ttf)}body {font-family: MyCustomFont, Verdana, Arial, 

sans-serif; font-size: medium; color: black}</head><body>

<h1>tamilStringEncoded </h1></body></html>

finally load data into webview ....

user3008032
  • 112
  • 12