On my website, I want to strive for reducing the page size as much as possible. As such, on Apple devices - I want to display my site using the native San Francisco font. On all other devices, I want to display (the extremely similar) Roboto font.
What's great about Roboto is that it's locally installed with Android ... and as such, I don't want to install the font if it already exist.
What I want to do is, is what's describen in the pseudo code below
if ("San Francisco" or "Roboto" not installed locally) {
// download Robot (and preload it for super fast performance)
<link rel="preload" as="font" href="/assets/fonts/roboto.woff2" type="font/woff2" crossorigin/>
}
I totally realize in my CSS, it already has the ability to fallback to another font like so
body { font:normal 1em -apple-system,"Roboto",sans-serif;}
The problem with the CSS code above, it slow and doesn't preload.
Now yes, I guess I could just PRELOAD the Roboto font for ALL page views, but that's seems completely wasteful.
Thoughts on how I can do this?