mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 13:56:43 +02:00
Fix
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user