This commit is contained in:
Dragon Fire
2024-04-26 01:19:38 -04:00
parent c978834029
commit c12112cd16
+3 -3
View File
@@ -207,13 +207,13 @@ module.exports = class TweetCommand extends Command {
const lineEmoji = line.match(emojiRegex());
const height = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent;
if (!lineEmoji) {
ctx.fillText(line, x, y + height * currentLine);
ctx.fillText(line, x, y + (height * currentLine));
continue;
}
let currentX = x;
for (let i = 0; i < lineNoEmoji.length; i++) {
const linePart = lineNoEmoji[i];
ctx.fillText(linePart, currentX, y + height * currentLine);
ctx.fillText(linePart, currentX, y + (height * currentLine));
currentX += ctx.measureText(linePart).width;
const parsedEmoji = twemoji.parse(emoji[i]);
if (!parsedEmoji.length || !parsedEmoji[0].url) continue;
@@ -221,7 +221,7 @@ module.exports = class TweetCommand extends Command {
const loadedEmoji = await loadImage(body);
loadedEmoji.width = emojiSize;
loadedEmoji.height = emojiSize;
ctx.drawImage(loadedEmoji, currentX, y + height, emojiSize, emojiSize);
ctx.drawImage(loadedEmoji, currentX, y + (height * currentLine), emojiSize, emojiSize);
currentX += emojiSize;
}
}