Transfer to @napi-rs/canvas again (this time w/ line breaks)

This commit is contained in:
Dragon Fire
2024-05-03 10:21:28 -04:00
parent 0d04b94797
commit bed3847f60
174 changed files with 234 additions and 227 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
const { createCanvas, loadImage } = require('canvas');
const { createCanvas, loadImage } = require('@napi-rs/canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
const { wrapText, fillTextWithBreaks } = require('../../util/Canvas');
module.exports = class SpongebobBurnCommand extends Command {
constructor(client) {
@@ -61,7 +61,7 @@ module.exports = class SpongebobBurnCommand extends Command {
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = wrapText(ctx, burn, 180);
ctx.fillText(lines.join('\n'), 55, 103);
fillTextWithBreaks(ctx, lines.join('\n'), 55, 103);
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(25);
ctx.fillText(person, 382, 26);
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20);