canvas-hypertxt icon indicating copy to clipboard operation
canvas-hypertxt copied to clipboard

Cannot use textwrapping function

Open paul097958 opened this issue 9 months ago • 0 comments

function renderWrappedText(ctx, value, width, x, y, fontSize, lineHeight) {
    ctx.font = "600 " + fontSize + "px sans-serif";

    let lines = split(ctx, value, fontSize + "px sans-serif", width, true);

    for (const line of lines) {
        ctx.fillText(line, x, y);
        y += lineHeight;
    }
}

I use this code to make my project, and if I don't setctx.font = "600 " + fontSize + "px sans-serif";the font will be very small. But that can make the wrapping function work.

paul097958 avatar May 15 '24 15:05 paul097958