From d9d648e4956b55f4f908c58df4b51e11a248ada9 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Wed, 16 Oct 2024 23:02:46 +0200 Subject: [PATCH] quoter new line brokey --- src/utils/quoter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/quoter.js b/src/utils/quoter.js index 854c5c8..dec7b99 100644 --- a/src/utils/quoter.js +++ b/src/utils/quoter.js @@ -15,7 +15,7 @@ function canvasToBuffer(canvas) { } function wrapText(context, text, x, y, maxWidth, lineHeight, preparingSentence, lines) { - const words = text.split(" "); + const words = text.split(/\s/g); for (let i = 0; i < words.length; i++) { const workSentence = preparingSentence.join(" ") + " " + words[i]; @@ -89,6 +89,8 @@ module.exports = { const quoteY = cardHeight / 2 - 10; wrapText(ctx, `"${quote}"`, quoteX, quoteY, quoteWidth, 20, preparingSentence, lines); + console.log("lines: " + lines.length); + const wrappedTextHeight = lines.length * 25; ctx.font = "bold 16px Twitter Color Emoji";