Closed Apocritas99 closed 2 years ago
I can't reproduce this without knowing what values you were passing to the function. What did you supply for font
, px
, and maxWidth
?
For me, the code below doesn't trigger any of those assertion messages:
function textFit(text, font, px, x, y, maxWidth) {
for (let index = 0; index < px; index++) {
ctx.font = `${px - index}px ${font}`
let txt = ctx.measureText(text)
if (txt.width < maxWidth) {
ctx.fillText(text, x, y);
return px-index
}
}
}
let size = textFit("Hello", "Arial", 20, 0, 0, 30)
console.log(size);
// prints: 13
textFith(ctx, 'Hello', 'Arista', 40, 196, 50, 315)
I tested against this version of Arista and still didn't get any unexpected output. What OS and node version are you running?
My guess is that the output you were seeing was coming from skia itself so hopefully the update to the newest milestone in 0.9.30 will have removed what looked to be unintentionally included debug code. Let me know if you keep seeing this issue with the current version of the library though...
well what is happening is that i have a function to fit the text in a area lowering the font size this is the code
and in my console i have this and i'm sure that i don't have any console log in the code
i want to know if its an issue of the library or im doing something wrong