Hacker News new | ask | show | jobs
by diverted 4230 days ago
Fonts arrive with a units specified, typically 1000 and with values for ascent/decent/xHeight/more.... This provides the basis for font sizing and kerning. In txt we know the relative sizes detailed in the font and we know each character size. This level of detail is unknown to the canvas API today, text is a black box returning images of characters. Also glyphs are drawn inverted along the true baseline so layout is very accurate in dealing with lineHeight and vertical positioning.
1 comments

If this library can do text-measurements faster than the native canvas measureText() calls can do them, then that part of the library would be interesting to have by itself. That's one thing I know for sure.