diff --git a/package-lock.json b/package-lock.json index 50aef06..0d59b7b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "songcard", - "version": "1.1.5", + "version": "1.1.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "songcard", - "version": "1.1.5", + "version": "1.1.6", "license": "ISC", "dependencies": { "canvas": "^2.11.2", diff --git a/package.json b/package.json index 24143e0..e8ebac2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "songcard", - "version": "1.1.5", + "version": "1.1.6", "main": "src/index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/src/themes/classicCard.js b/src/themes/classicCard.js index 9fdeb08..54c2a1b 100644 --- a/src/themes/classicCard.js +++ b/src/themes/classicCard.js @@ -1,4 +1,4 @@ -const { createCanvas, loadImage } = require("canvas"); +const { createCanvas, loadImage, registerFont } = require("canvas"); const Jimp = require("jimp"); const path = require("path"); @@ -9,9 +9,8 @@ async function classicCard({ trackDuration, trackTotalDuration, }) { - const Canvas = require("canvas"); const fontPath = path.join(__dirname, '..', 'fonts', 'NotoSans-Regular.ttf'); - Canvas.registerFont(fontPath, { family: "Noto Sans" }); + registerFont(fontPath, { family: "Noto Sans" }); const prettyMilliseconds = (await import("pretty-ms")).default; const canvasWidth = 1200; diff --git a/src/themes/simpleCard.js b/src/themes/simpleCard.js index 108f97c..f1bc841 100644 --- a/src/themes/simpleCard.js +++ b/src/themes/simpleCard.js @@ -1,11 +1,10 @@ -const { createCanvas, loadImage } = require("canvas"); +const { createCanvas, loadImage, registerFont } = require("canvas"); const Jimp = require("jimp"); const path = require("path"); async function simpleCard({ imageBg, imageText }) { - const Canvas = require("canvas"); const fontPath = path.join(__dirname, '..', 'fonts', 'NotoSans-Regular.ttf'); - Canvas.registerFont(fontPath, { family: "Noto Sans" }); + registerFont(fontPath, { family: "Noto Sans" }); const canvasWidth = 600; const canvasHeight = 600;