mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 08:17:35 +02:00
Don't allow skinny images in meme-gen
This commit is contained in:
@@ -99,6 +99,7 @@ module.exports = class CanvasUtil {
|
||||
static wrapText(ctx, text, maxWidth) {
|
||||
return new Promise(resolve => {
|
||||
if (ctx.measureText(text).width < maxWidth) return resolve([text]);
|
||||
if (ctx.measureText('W').width > maxWidth) return resolve(null);
|
||||
const words = text.split(' ');
|
||||
const lines = [];
|
||||
let line = '';
|
||||
|
||||
Reference in New Issue
Block a user