()
| 189 | } |
| 190 | |
| 191 | resize() { |
| 192 | this.context.font = this.font; |
| 193 | const metrics = this.context.measureText(this.txt); |
| 194 | |
| 195 | const textWidth = Math.ceil(metrics.width) + 20; |
| 196 | const textHeight = Math.ceil(metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent) + 20; |
| 197 | |
| 198 | this.canvas.width = textWidth; |
| 199 | this.canvas.height = textHeight; |
| 200 | } |
| 201 | |
| 202 | render() { |
| 203 | this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); |