This is actually a hard problem even for most font libraries as it requires 'execution' of the font and kerning to actually know the parameters. I'm not saying this is a good answer but this is a tricky problem outside just Canvas2D. E.g. sour, soup, slip, and shin are four words with different heights, how do each in turn play out? Most of the time this is external to the font library and is in the layout engine which is talking to the font rendering context the same way you are in a raw font library/canvas.
To be honest this is one of the things that made web browsers and html so good is because it solves this problem really well compared to having to figure this out in native apps across languages the hard way.