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:
parent
736aeb371d
commit
dd6fbc6c1f
@ -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 =
|
||||
|
Loading…
x
Reference in New Issue
Block a user