I am loading a webpage in my WKWebView
in ios application. But WKWebview
changes all the fonts of my webpage randomly. This issue never happened before with UIWebView
. I need to tackle this issue in XCode. How can I make sure that the correct fonts are loaded in my application.
I have tried loading the custom fonts in XCode with face font and html string.
let htmlString = """
<style>
@font-face
{
font-family: 'Tahoma';
font-weight: normal;
src: url(Tahoma Bold.ttf);
}
</style>
<span style="font-family: 'Tahoma'; font-weight: bold; font-size: 30; color: red">(Utils.aboutUsText)</span>
"""
landingWebView.loadHTMLString(htmlString, baseURL: Bundle.main.bundleURL)
I expect the WKWebview
to load the original fonts and I have to implement the solution on XCode side.