Has anyone figured out how to get a custom font in a WKWebView to match the dynamic type settings of a UIKit/SwiftUI view?
`font: -apple-system-body` will match .body in the view with the San Francisco system font, but I can't find something similar if I'm using `font: “Custom”`
I _really_ don't want to start sniffing around in font metrics (especially in SwiftUI where they are essentially unavailable).
@chockenberry https://bugs.webkit.org/show_bug.cgi?id=260880 seems to show that you can set `font: -apple-system-body` on e.g. the `html` element and then use `font-size: 1.2rem` to be 20% larger than that base font. Presumably you can also then update the font on a per-element basis (or for the whole page with `body`).
@josephduffy Thanks! This looks promising:
html {
font: -apple-system-title;
font-family: "Custom";
font-variant-emoji: emoji;
}
Gets the metrics with `font` and overrides system font with `font-family`.