WKWebView with dynamic type & custom font

Hi,


inside our application, we need to use a WKWebView.

The app uses dynamc type and a custom font all over. So we want this to get included into the WKWebView too.


I can enable dynamic type inside the css -> we lose the custom font

font: -apple-system-body;

I can load my custom font -> we lose dynamic type

@font-face
{
    font-family: 'Open Sans';
    font-weight: normal;
    src: url(OpenSans-Regular.ttf);
}


Is there a why to use dynamic type with custom font inside a WKWebView?

Replies

Hi FunkyMusic,


I'm facing the same issue and I don't know how to achieve it. Did you get to any solution?


Thanks

Can you get notifications for when type size changes? If so, you can adjust your size at that point.

You can serve the custom font from within your application and load it from the WebView with a http://localhost:.../.../dynamicFont.ttf URL. In turn, the “web server” inside the app decides which font to return based on the current dynamic type configuration.