Font Command

This commit is contained in:
Dragon Fire
2021-02-20 11:26:43 -05:00
parent 7f448a7712
commit 4a2c294947
5 changed files with 103 additions and 2 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ module.exports = class TypingTestCommand extends Command {
generateImage(sentence) {
const canvasPre = createCanvas(1, 1);
const ctxPre = canvasPre.getContext('2d');
ctxPre.font = '75px Noto';
ctxPre.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(75);
const len = ctxPre.measureText(sentence);
const canvas = createCanvas(100 + len.width, 200);
const ctx = canvas.getContext('2d');