The FontMetrics API solves this, hopefully browsers will ship it someday.
https://drafts.css-houdini.org/font-metrics-api-1/
RIP eae@.