Android hindi font support for TextView and WebView

795 Views Asked by At

I am creating an application with Hindi language. I do not set hindi font(By using the TextView.setTypeface() method) in TextView as well as WebViewbut its working fine. I have only two devices to test my application.

So my questions are:

  1. Is it necessary to set font in TextViewto support over all devices or it will woking fine without setting font?
  2. How to set hindi font in WebView(If not supported over all devices)?
3

There are 3 best solutions below

1
On

Its vendor specific how the device is been built for different languages. But one thing can be guarantied that most of the devices will support because they have to survive in the market.

If ur using typeface then that typeface should be available in that device. look at this issue link

0
On

1 Is it necessary to set font in TextViewto support over all devices or it will woking finewithout setting font?

if you won`t define text for the textView/edit text it will get default text size accordoing to device. but its a good practice to define fonts

2.How to set hindi font in WebView(If not supported over all devices)?

to add hindi font you can use it like this

@font-face {
    font-family: 'feast';
    src: url('fonts/feasfbrg.ttf');
}

body {font-family: 'feast';}

Then use the assets path as the base url:

loadDataWithBaseURL("file:///android_asset/",myhtml,"text/html","utf-8",null);
3
On
 <meta charset="UTF-8">
  add it to your html file