This commit is contained in:
Dragon Fire
2024-04-26 01:22:53 -04:00
parent 6863b7b145
commit 33e1058db7
+1 -2
View File
@@ -197,7 +197,6 @@ module.exports = class TweetCommand extends Command {
async fillTextWithEmoji(ctx, text, x, y, maxLineLen, emojiSize) { async fillTextWithEmoji(ctx, text, x, y, maxLineLen, emojiSize) {
const wrapped = wrapText(ctx, text, maxLineLen, true); const wrapped = wrapText(ctx, text, maxLineLen, true);
const emoji = text.match(emojiRegex()); const emoji = text.match(emojiRegex());
const metrics = ctx.measureText('W');
if (!emoji) { if (!emoji) {
ctx.fillText(wrapped.join('\n'), x, y); ctx.fillText(wrapped.join('\n'), x, y);
return ctx; return ctx;
@@ -206,7 +205,7 @@ module.exports = class TweetCommand extends Command {
const line = wrapped[currentLine]; const line = wrapped[currentLine];
const lineNoEmoji = line.split(emojiRegex()); const lineNoEmoji = line.split(emojiRegex());
const lineEmoji = line.match(emojiRegex()); const lineEmoji = line.match(emojiRegex());
const height = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent; const height = 23 + 9;
if (!lineEmoji) { if (!lineEmoji) {
ctx.fillText(line, x, y + (height * currentLine)); ctx.fillText(line, x, y + (height * currentLine));
continue; continue;