在 WebView 中设置字体样式 html 问题
Setting the font style in WebView html issue
我需要在 webView Html 页面中使用 UhmanicHafs.ttf 字体来获得预期的输出。
我正在设置uthmanic font
:
webviewHTML.loadDataWithBaseURL("file:///android_asset/fonts/UthmanicHafs.ttf",
myHtmlString, "text/html", Xml.Encoding.UTF_8.toString(), null);
然后我得到 Actual Output
如果我像这样删除 UthmanicHafs.ttf
字体:
webviewHTML.loadDataWithBaseURL("file:///android_asset/", myHtmlString, "text/html", Xml.Encoding.UTF_8.toString(), null);
我收到这个Expected Output
我需要的:
我需要使用 Uthmanic 字体并获得 Expected output.Anyone 可以帮助 this.Thank 你。
您需要在 css 文件中设置如下自定义字体
对于此示例,将 CSS 写入:
@font-face {
font-family: 'feast';
src: url('fonts/yourfont.ttf');
}
body {font-family: 'feast';}
Then use the assets path as the base url:
loadDataWithBaseURL("file:///android_asset/",myhtml,"text/html","utf-8",null);
那么它应该可以正常工作了。
我需要在 webView Html 页面中使用 UhmanicHafs.ttf 字体来获得预期的输出。
我正在设置uthmanic font
:
webviewHTML.loadDataWithBaseURL("file:///android_asset/fonts/UthmanicHafs.ttf",
myHtmlString, "text/html", Xml.Encoding.UTF_8.toString(), null);
然后我得到 Actual Output
如果我像这样删除 UthmanicHafs.ttf
字体:
webviewHTML.loadDataWithBaseURL("file:///android_asset/", myHtmlString, "text/html", Xml.Encoding.UTF_8.toString(), null);
我收到这个Expected Output
我需要的:
我需要使用 Uthmanic 字体并获得 Expected output.Anyone 可以帮助 this.Thank 你。
您需要在 css 文件中设置如下自定义字体
对于此示例,将 CSS 写入:
@font-face {
font-family: 'feast';
src: url('fonts/yourfont.ttf');
}
body {font-family: 'feast';}
Then use the assets path as the base url:
loadDataWithBaseURL("file:///android_asset/",myhtml,"text/html","utf-8",null);
那么它应该可以正常工作了。