3 ms·
Can't you just render text to a canvas element then crop the canvas? That results in the exact bounding dimensions you need.
by wackget 5y ago
Can't you just render text to a canvas element then crop the canvas? That results in the exact bounding dimensions you need.
- munchbunny 5y agoNot always. In my experience there are two things that tend to break when you try to render to canvas and apply the empirically measured dimensions to HTML text: (1) subpixel rendering because it does still exist despite high DPI displays, and (2) kerning and hinting don't always give you the same metrics inside/outside canvas, especially for non-Latin characters.