Android: I Want Use My Custom Font with Webviewb

android : i want use my custom font with WebViewb

A solution is document here: How to use custom font with WebView

is this similar to what you tried to use in your html file?
With the url relative to your assets folder in this case?

@font-face {
font-family: 'AQF_P001_HA';
src: url('AQF_P001_HA.TTF');
}

body {font-family: 'AQF_P001_HA';}

Custom font for webview

There is a bug report for Android that seems to suggest that custom fonts don't work for certain languages (Thai, Hebrew, Farsi, and Arabic have been mentioned). This hasn't been confirmed by anyone from Google, but there are a number of people reporting the same problem.

One of the suggested solutions (which at least one user confirmed as working) was to convert the font from otf to svg. There are a number of online tools that will do this for you (Everything Fonts is one example), but you may have issues with this being a copyrighted font - make sure your font license permits such conversions.

Also, when you have converted the font, open it up in a text editor and check whether the svg element is namespaced. It should look something like this:

<svg xmlns="http://www.w3.org/2000/svg">

If it is just <svg> without the namespace, you may need to add the xmlns attribute manually. Apparently, svg fonts without the namespace don't work either.



Related Topics



Leave a reply



Submit