quoter new line brokey

This commit is contained in:
Ashley Graves 2024-10-16 23:02:46 +02:00
parent 79ab38f8f0
commit d9d648e495

View file

@ -15,7 +15,7 @@ function canvasToBuffer(canvas) {
} }
function wrapText(context, text, x, y, maxWidth, lineHeight, preparingSentence, lines) { 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++) { for (let i = 0; i < words.length; i++) {
const workSentence = preparingSentence.join(" ") + " " + words[i]; const workSentence = preparingSentence.join(" ") + " " + words[i];
@ -89,6 +89,8 @@ module.exports = {
const quoteY = cardHeight / 2 - 10; const quoteY = cardHeight / 2 - 10;
wrapText(ctx, `"${quote}"`, quoteX, quoteY, quoteWidth, 20, preparingSentence, lines); wrapText(ctx, `"${quote}"`, quoteX, quoteY, quoteWidth, 20, preparingSentence, lines);
console.log("lines: " + lines.length);
const wrappedTextHeight = lines.length * 25; const wrappedTextHeight = lines.length * 25;
ctx.font = "bold 16px Twitter Color Emoji"; ctx.font = "bold 16px Twitter Color Emoji";