I have a WebView
displaying content which is not controlled by me. The WebView
content is previews of files, such as PowerPoint documents, or a PDF file, word document etc.
When the user changes the font size on their devices (Settings -> Accessibility -> Font size) the WebView uses this adjusted font size. This results in the layout of the contents of the WebView being wrong and not aligned as designed anymore. One example is in my preview of a PowerPoint presentation, the text is now enlarged so it covers a diagram to the right of the text and other text runs off the edge of the slide.
How can I get the WebView to completely ignore any system font settings and only use the font sizes specified in the HTML/CSS for the content in the WebView?
I have seen lots of comments on stack overflow about how you can set the font in the WebView
to a fixed size, for example :
webView.getSettings().setTextSize(WebSettings.TextSize.NORMAL); // Deprecated
webView.getSettings().setTextZoom(100);
But I do NOT want to do this. I want the font size to be determined by the HTML/CSS in the WebView
which I will never know the values of as the contents of the WebView
can be anything.