Hi,
Is there any working sample for using a custom font in WKWebView?
Here's my code :
thanks in advance
Is there any working sample for using a custom font in WKWebView?
Here's my code :
B4X:
#AppFont: dubaiw23_medium.ttf
tTypefaceMedium = Font.CreateNew2("DubaiW23-Medium", 18)
Sub LoadWebView(webview As WKWebView, sText As String)
Dim s As String = "<html>" & _
"<head>" & _
"<style Type='text/css'>@font-face { font-family: 'DubaiW23-Medium'; font-size: 53px; src: url(dubaiw23_medium.ttf);} </style>" & _
"</head>" & _
"<body>" & _
"<div style='direction: rtl; font-family: 'DubaiW23-Medium'; color: red'>" & sText & "</div>" & _
"</body>" & _
"</html>"
webview.LoadHtml(s)
End Sub
thanks in advance
Last edited: