// TODO: move this to a worker let c2d = null; function init_rasterizer() { c2d = document.querySelector('#offscreen').getContext('2d'); c2d.font = '14px monospace'; c2d.fillStyle = 'white'; } function rasterize(text) { c2d.clearRect(0, 0, c2d.canvas.width, c2d.canvas.height); c2d.fillText(text, 0, 14); //c2d.fillRect(0, 0, 32, 32); }