mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Font Command
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user