As the title suggests, I am trying to simulate p5.js fontToPoints method in regular JavaScript, as I don't want to use their library.
I have no idea how I can even begin to do this though, I have created a canvas, and displayed text on that canvas, however I want to be able to get the points around that canvas that outline the text, and I want that in an array. However, no clue...
For an example of what Im looking for...
textToFont example for 'train'
My current code attempt that simply outlines the text...
function setCanvas() {
let windowWidth = $(window).width();
let windowHeight = $(window).height()
let title = document.getElementById("title").innerText;
canvas.width = windowWidth;
canvas.height = windowHeight * 0.3;
ctx.fillStyle = 'red';
ctx.strokeStyle = 'black';
ctx.textAlign = "center";
ctx.font = "100px Montserrat";
ctx.strokeText(title, canvas.width/2, canvas.height/2);
ctx.fill();
ctx.stroke();
}
How would I go about doing this?