Hello,
On the Android platform, if you want to use fonts in a WebView, you need to add an Android asset prefix file:///android_asset/
to the font file.
You could refer to the following example:
<WebView>
<WebView.Source>
<HtmlWebViewSource>
<HtmlWebViewSource.Html>
<![CDATA[
<html>
<head>
<style type="text/css">
@font-face {
font-family: MyFont;
src: url("file:///android_asset/OpenSans-Semibold.ttf")
}
body {
font-family: MyFont;
font-size: medium;
text-align: justify;
}
</style>
</head>
<body>
<p>Hello World</p>
</body>
</html>
]]>
</HtmlWebViewSource.Html>
</HtmlWebViewSource>
</WebView.Source>
</WebView>
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.