Font Size possibly should be based on `unitsPerEm`
CryZe opened this issue · comments
It is a bit unclear to me how font size works, but it seems like the way our path based text engine handles the font size isn't how the browsers or any other renderer really handles it. So far we defined it to be the distance from the ascender to the descender, but it seems like it may be the unitsPerEm
value of the head
table that we should be using instead. This needs to be investigated further. If this turns out to be true, we should switch to it and adjust the font size related constants accordingly.
This post seems to confirm it as well: https://tonsky.me/blog/font-size/
Long story short, this [em] square is what you actually control when setting font size.
The em square apparently is super arbitrary, and the blog post recommends cap height instead (which we almost definitely can't portably query), so I'd say the ascender descender distance is the next best thing. So this probably can already be closed again.
I'm closing this as what we are doing seems good enough.