I am facing an issue with implementing a WKWebView
that supports both custom fonts and dynamic type simultaneously. Individually, they work fine but not together.
My CSS code for this section is quite straightforward:
body {
font-family: 'MyCustomFont';
font-size: 15px;
}
To enable dynamic type, I modified it to the following:
body {
font-family: 'MyCustomFont';
font: -apple-system-body;
}
I have set up an observer to detect changes in the notification
UIContentSizeCategory.didChangeNotification
in order to refresh the webview. While the font size adjusts smoothly, it defaults to the system font instead of the custom one.
Any suggestions on how to resolve this and ensure both functionalities work seamlessly?