-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
Description
const {
width: glyphAdvance,
actualBoundingBoxAscent,
actualBoundingBoxDescent,
actualBoundingBoxLeft,
actualBoundingBoxRight
} = this.ctx.measureText(char);
const glyphWidth = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(actualBoundingBoxRight - actualBoundingBoxLeft)));
const glyphHeight = Math.min(this.size - this.buffer, glyphTop + Math.ceil(actualBoundingBoxDescent));
const imgData = ctx.getImageData(buffer, buffer, glyphWidth, glyphHeight);
actualBoundingBoxRight, actualBoundingBoxLeft, actualBoundingBoxDescent
These values may be undefined in low-end machine environments, which will cause the glyphWidth and glyphHeight to be calculated as NaN, which will cause the ctx.getImageData method to throw a DOMException error.