webview with unicode font

selvamurali

Active Member
Licensed User
Longtime User
dear team

i have a listview contain some url. when user clik the url it will open via webview. but the url pages in unicode fonts. it show only boxes. so how to i embeed a font for webview to load the url.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is how it looks on Galaxy Nexus:
SS-2013-01-08_11.04.50.png


The font is determined by the site itself (usually in the CSS page).

You can probably override the font by injecting JavaScript that will change the font.
 
Upvote 0

selvamurali

Active Member
Licensed User
Longtime User
javascript to override font

thanks for your reply Erel.
can u post some example for your reply.(You can probably override the font by injecting JavaScript that will change the font.)
 
Upvote 0

selvamurali

Active Member
Licensed User
Longtime User
Url

in jelly beans all font is include but other previous versions all fonts not included . so how to i load the urls in previous versions .
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Not sure that a jscript could solve this. Perhaps the necessary font is missing in the specific device's rom distribution. Tested this page with the native browser or any other installed?
 
Upvote 0

selvamurali

Active Member
Licensed User
Longtime User
Url

Thanks for Your reply mc73 . i have tested with native browser. is there any way to embeed my font with webview load url.
 
Upvote 0

metrick

Active Member
Licensed User
Longtime User
Thanks for Your reply mc73 . i have tested with native browser. is there any way to embeed my font with webview load url.
Try this.
1. Copy following line to your_file.html between the <header></header>
<link rel='stylesheet' href='file:///android_asset/stylesheet.css' type='text/css'>

2. copy the following to text edit, but replace the FontName with your native web utf-8 font name and save as stylesheet.css, and add all the fonts and stylesheets.css to Dir.Asset Folder
/* Start copy below this line */
@font-face {
font-family: 'NameFontFamilyHere';
src: url('file:///android_asset/FontName.eot');
src: url('file:///android_asset/FontName.eot?#iefix') format('embedded-opentype'),
url('file:///android_asset/FontName.woff') format('woff'),
url('file:///android_asset/FontName.ttf') format('truetype'),
url('file:///android_asset/FontName.svg#FontName') format('svg');
font-weight: normal;
font-style: normal;

}
body {font-family: NameFontFamilyHere;}
h1, h2 {font-family: NameFontFamilyHere; font-weight: normal}
textarea{font-family:NameFontFamilyHere;}
p{font-family: NameFontFamilyHere;}
/* End copy above this line */
Hope this will help or path to right direction.
 
Upvote 0
Top