or OffscreenCanvas • Supported in non-browser runtimes using libraries like node-canvas or skia-canvas • Native non-browser runtime support (OffscreenCanvas) ◦ Deno: WIP by me ◦ Andromeda: supported 8
textMetrics = ctx.measureText(text); // Measure width position per Glyph Cluster at once for (const { begin, end } of textMetrics.getTextClusters()) { const rect = textMetrics.getActualBoundingBox(begin, end); console.log(rect.width); } • Planned to ship in Chrome 160 (2027-01-25) ◦ But... 14
= ctx.shapeText(text); // Measure width position per Glyph Cluster at once for (const { begin, end } of shapedText.glyphClusters()) { const rect = shapedText.getActualBoundingBox(begin, end); console.log(rect.width); } • Create Shaped Text, not Enhanced Text Metrics • WebKit spotted preparing a proposal (last week) 15