4 ms·
yes! I went through this a few years back. My god, what a pain in the ass. According to MDN, the TextMetrics API is fully supported by all modern browsers. Chro
by deckard1 5y ago
yes! I went through this a few years back. My god, what a pain in the ass. According to MDN, the TextMetrics API is fully supported by all modern browsers. Chrome added the necessary height support in version 87 it looks like. But the entire API is still marked as experimental. Maybe them moving Google Docs to canvas helped that out.
Chrome also introduced the Local Font Access API. Which sounds like a privacy nightmare. You can get access to the font's actual byte data and render it yourself, bypassing the browser entirely. Sounds insane to me. Imagine trying to beat your browser or OS at font rendering, but doing it in JavaScript. I guess Adobe or Figma have deep enough pockets to try though.
- PaulDavisThe1st 5y agoComing soon to a browser standards body near you: * WebHarfBuzz * WebFontConfig * WebPango Nothing radically new here, since Canvas is essentially WebCairo-with-the-good-bits-missing.
- danielvaughn 5y agoThe TextMetrics thing is so confusing because the docs clearly say that it's supported, but I tried to use it as recently as last year, and it's definitely not working. edit: getting access to the font bits sounds enticing to me actually, because I'm kind of a masochist :)