I want change the default font of webview to a custom font. I\'m using webview in developing an bilingual browser app for Android.
I tried getting an instance of cus
i done this by upper answers with this additions:
webView.loadDataWithBaseURL("file:///android_asset/",
WebClient.getStyledFont(someText),
"text/html; charset=UTF-8", null, "about:blank");
and then use src: url("file:///android_asset/fonts/YourFont...
public static String getStyledFont(String html) {
boolean addBodyStart = !html.toLowerCase().contains("");
boolean addBodyEnd = !html.toLowerCase().contains("@font-face {font-family: CustomFont;" +
"src: url(\"file:///android_asset/fonts/Brandon_reg.otf\")}" +
"body {font-family: CustomFont;font-size: medium;text-align: justify;}" +
(addBodyStart ? "" : "") + html + (addBodyEnd ? "" : "");
}
thanks to everybody:)