xxxxxxxxxx
49
let font;
let points;
function preload() {
font = loadFont('JosefinSans.ttf')
}
function setup() {
createCanvas(600, 600);
textAlign(CENTER);
let string = 'SAEED';
let fontSize = 120;
let textX = width/2;
let textY = height/2;
let tb = font.textBounds(string, textX, textY, fontSize);
let w0 = tb.w;
let h0 = tb.h;
let s = 0.15 // sample factor
textX = textX - (w0/2);
textY = textY + (h0/2);
textSize(fontSize);
points = font.textToPoints(string, textX, textY, fontSize, {sampleFactor: s});
}
function draw() {
background(220);
push();
strokeWeight(4);
for(let i = 0; i<points.length; i++) {
point(points[i].x, points[i].y);
}
pop();
}