Earlier quoted context omitted.
> If you can measure the text because you know which font will be used If you are using text, you can’t know which font will be used. There are no universally-available fonts, so web fonts are the closest you get, but they could fail to load for various reasons, and it’s honestly more common than people allow for. You can also block web fonts (e.g. uBlock Origin has an entire button for it), or just turn off font sel…
You could embed your web font inline to the stylesheet, as base64 encoded data url. @font-face { src: url(data:application/font-woff2;charset=utf-8;base64,...) format('woff2'); } Your page loading times will obviously take a hit, but that'll give you pretty close to 100% certainty that the font will be used, should you want that.
Aside, pairing application/font-woff2 with charset=utf-8 makes no sense. It’s a binary encoding.
But I think you’d still be surprised how many browser configurations don’t load web fonts, though I’m sure it’s becoming less common.