1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

textMetricsTest: insert canvas in DOM

This commit is contained in:
kkapsner 2020-03-15 13:43:41 +01:00
parent 736aeb371d
commit dd6fbc6c1f

View File

@ -43,6 +43,7 @@
async function testMeasureText(){
const canvas = document.createElement("canvas");
document.body.appendChild(canvas);
const node = document.createElement("span");
document.body.appendChild(node);
const context = canvas.getContext("2d");
@ -74,9 +75,12 @@
propertyDataIndex += 1;
if (textMetric.width !== domRect.width){
differences += 1;
console.log("difference at", char, "(", charCodePoint, ")", "with", font);
console.log(textMetric.width, "!==", domRect.width);
}
});
});
document.body.removeChild(canvas);
document.body.removeChild(node);
document.querySelector("#measureText .differences").textContent =