mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
wrapText is no longer async
This commit is contained in:
@@ -50,7 +50,7 @@ module.exports = class SubtitleCommand extends Command {
|
||||
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
|
||||
ctx.fillStyle = 'yellow';
|
||||
ctx.textAlign = 'center';
|
||||
const lines = await wrapText(ctx, text, base.width - 10);
|
||||
const lines = wrapText(ctx, text, base.width - 10);
|
||||
if (!lines) return msg.reply('There\'s not enough width to subtitle this image.');
|
||||
ctx.textBaseline = 'bottom';
|
||||
const initial = base.height - ((lines.length - 1) * fontSize) - (fontSize / 2) - ((lines.length - 1) * 10);
|
||||
|
||||
@@ -138,7 +138,7 @@ module.exports = class YuGiOhGenCommand extends Command {
|
||||
}
|
||||
const font = monsterType === 'normal' ? 'Stone Serif LT Italic.ttf' : 'Matrix Book.ttf';
|
||||
ctx.font = this.client.fonts.get(font).toCanvasString(27);
|
||||
const wrappedEffect = await wrapText(ctx, effect, 690);
|
||||
const wrappedEffect = wrapText(ctx, effect, 690);
|
||||
const trimmed = wrappedEffect.slice(0, type === 'monster' ? 4 : 6);
|
||||
ctx.fillText(trimmed.join('\n'), 63, 933 - (type === 'monster' ? 0 : 34));
|
||||
ctx.font = this.client.fonts.get('Stone Serif.ttf').toCanvasString(22);
|
||||
|
||||
Reference in New Issue
Block a user