widthsMap = {
style;
const chars = [];
const widths = [];
for (let i = 33; i < 127; i++) {
chars[i] = String.fromCharCode(i);
}
const letter = d3
.select("#calibrate")
.selectAll("text.calibrate")
.data(chars)
.enter()
.append("text")
.classed("calibrate", true)
.text((d) => d)
.each(function (d) {
console.log(d);
const bb = this.getBoundingClientRect();
widths.push(bb.width);
});
const space = d3
.select("#calibrate")
.append("text")
.classed("calibrate", true)
.text("t t")
.each(function (d) {
const bb = this.getBoundingClientRect();
widths[32] = bb.width - 2 * widths["t".charCodeAt(0)];
});
d3.select("svg").selectAll("text.calibrate").remove();
return widths.map((d) => d / 10);
}