From cfdc021a374c25b4a453bdb78e16611c471c1214 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 23 May 2020 12:15:59 -0400 Subject: [PATCH] Fix font size in two-buttons --- commands/edit-meme/two-buttons.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/edit-meme/two-buttons.js b/commands/edit-meme/two-buttons.js index 5dbe5616..ae01fb85 100644 --- a/commands/edit-meme/two-buttons.js +++ b/commands/edit-meme/two-buttons.js @@ -54,18 +54,19 @@ module.exports = class TwoButtonsCommand extends Command { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'two-buttons.png')); const canvas = createCanvas(base.width, base.height); const ctx = canvas.getContext('2d'); + ctx.textBaseline = 'top'; ctx.drawImage(base, 0, 0); ctx.rotate(-12 * (Math.PI / 180)); - ctx.font = '50px Noto'; - let fontSize = 50; + ctx.font = '34px Noto'; + let fontSize = 34; while (ctx.measureText(first).width > 244) { fontSize -= 1; ctx.font = `${fontSize}px Noto`; } const firstLines = await wrapText(ctx, first, 183); ctx.fillText(firstLines.join('\n'), 45, 178); - ctx.font = '50px Noto'; - fontSize = 50; + ctx.font = '34px Noto'; + fontSize = 34; while (ctx.measureText(second).width > 163) { fontSize -= 1; ctx.font = `${fontSize}px Noto`;