This is taken from source/os/canvastext.ts
The total var seems to be the length of the string in terms of width. But... it never gets changed anywhere after initiating. Then at the bottom it just returns 0.
public static draw(ctx, font, size, x, y, str) {
var total = 0;
var len = str.length;
var mag = size / 25.0;
ctx.save();
ctx.lineCap = "round";
ctx.lineWidth = 2.0 * mag;
ctx.strokeStyle = "black";
for (var i = 0; i < len; i++) {
var c = CanvasTextFunctions.letter(str.charAt(i));
if (!c) {
continue;
}
ctx.beginPath();
var penUp = true;
var needStroke = 0;
for (var j = 0; j < c.points.length; j++) {
var a = c.points[j];
if (a[0] === -1 && a[1] === -1) {
penUp = true;
continue;
}
if (penUp) {
ctx.moveTo( x + a[0]*mag, y - a[1]*mag);
penUp = false;
} else {
ctx.lineTo( x + a[0]*mag, y - a[1]*mag);
}
}
ctx.stroke();
x += c.width*mag;
}
ctx.restore();
return total;
}