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";