Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To add on to the text note, it's actually even more annoying with Canvas to draw it correctly. None of the major browsers implement a TextMetrics object (the return of ctx.measureText) that has anything more than the width of the text. https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics

How anyone thought it was OK not to ship that is beyond me, but it means that when laying out content on the canvas you have to write a hack for the font height and hope it's good enough for most cases. I think there is a polyfill available but I believe it works by rendering the text in SVG and measuring it there which seems to defeat the purpose of doing it on canvas.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: