mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 10:25:11 +02:00
Border
This commit is contained in:
@@ -56,13 +56,21 @@ module.exports = class MemeGenCommand extends Command {
|
|||||||
const topLines = await wrapText(ctx, top, base.width - 10);
|
const topLines = await wrapText(ctx, top, base.width - 10);
|
||||||
for (let i = 0; i < topLines.length; i++) {
|
for (let i = 0; i < topLines.length; i++) {
|
||||||
const textHeight = (i * fontSize) + (i * 10);
|
const textHeight = (i * fontSize) + (i * 10);
|
||||||
ctx.fillText(topLines[i], base.width / 2, textHeight);
|
ctx.strokeStyle = 'black';
|
||||||
|
ctx.lineWidth = 8;
|
||||||
|
ctx.strokeText(topLines[i], base.width / 2, textHeight);
|
||||||
|
ctx.fillStyle = 'white';
|
||||||
|
ctx.fillText(bottomLines[i], base.width / 2, textHeight);
|
||||||
}
|
}
|
||||||
const bottomLines = await wrapText(ctx, bottom, base.width - 10);
|
const bottomLines = await wrapText(ctx, bottom, base.width - 10);
|
||||||
ctx.textBaseline = 'bottom';
|
ctx.textBaseline = 'bottom';
|
||||||
const initial = base.height - ((bottomLines.length - 1) * fontSize) - ((bottomLines.length - 1) * 10);
|
const initial = base.height - ((bottomLines.length - 1) * fontSize) - ((bottomLines.length - 1) * 10);
|
||||||
for (let i = 0; i < bottomLines.length; i++) {
|
for (let i = 0; i < bottomLines.length; i++) {
|
||||||
const textHeight = initial + (i * fontSize) + (i * 10);
|
const textHeight = initial + (i * fontSize) + (i * 10);
|
||||||
|
ctx.strokeStyle = 'black';
|
||||||
|
ctx.lineWidth = 8;
|
||||||
|
ctx.strokeText(bottomLines[i], base.width / 2, textHeight);
|
||||||
|
ctx.fillStyle = 'white';
|
||||||
ctx.fillText(bottomLines[i], base.width / 2, textHeight);
|
ctx.fillText(bottomLines[i], base.width / 2, textHeight);
|
||||||
}
|
}
|
||||||
const attachment = canvas.toBuffer();
|
const attachment = canvas.toBuffer();
|
||||||
|
|||||||
Reference in New Issue
Block a user