See the Slug thread from earlier today for context...
Slug: Dynamic GPU Font Rendering and Advanced Text Layout https://news.ycombinator.com/item?id=20475111
WebGL context encapsulated as an SkSurface,
allowing for direct drawing to an HTML canvas.
However, I just discovered this project a few hours ago so I don't know if there's any "gotchas" -- hopefully someone more knowledgeable or on the chrome/skia team will chime in.Running this on one of the examples.
let c=document.querySelector("#canvas");
c.getContext("2d"); >>>> null
c.getContext("webgl"); >>>> WebGLRenderingContext { vertexAttribDivisor: vertexAttribDivisor(), drawArraysInstanced: drawArraysInstanced(), drawElementsInstanced: drawElementsInstanced(), createVertexArray: createVertexArray(), deleteVertexArray: deleteVertexArray(), bindVertexArray: bindVertexArray(), isVertexArray: isVertexArray(), drawBuffers: drawBuffers(), Yu: null, canvas: canvas#canvas }
c.getContext("webgl2"); >>>> null
Of course that doesn't stop it from using any amount of software rendering layers before it hits the canvas, but it's a good sign.
[1] - https://developers.google.com/web/updates/2012/07/Taking-adv... [2] - http://fhtr.org/gravityring/sprites.html