From 6ce5935c42760f730f17b803d55626f336d40cf8 Mon Sep 17 00:00:00 2001 From: Sophie Kirschner Date: Wed, 18 Nov 2020 11:19:35 +0200 Subject: [PATCH 1/2] Update canvas dependency version Prior version no longer works with newer versions of node --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a8cbf0c..11ad3a8 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ }, "license": "MIT", "dependencies": { - "canvas": "^1.4.0", + "canvas": "^2.6.1", "map-limit": "0.0.1", "multi-bin-packer": "^1.1.3", "opentype.js": "^0.6.4" From de81f637213545c6d0da376e5de3a348c66ecf4e Mon Sep 17 00:00:00 2001 From: Sophie Kirschner Date: Wed, 18 Nov 2020 11:23:15 +0200 Subject: [PATCH 2/2] Update canvas API usage Package version upgrade introduced a breaking change --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 71385dd..cc52969 100644 --- a/index.js +++ b/index.js @@ -52,7 +52,7 @@ function generateBMFont (fontPath, opt, callback) { if (font.outlinesFormat !== 'truetype') { throw new TypeError('must specify a truetype font'); } - const canvas = new Canvas(textureWidth, textureHeight); + const canvas = Canvas.createCanvas(textureWidth, textureHeight); const context = canvas.getContext('2d'); const packer = new MultiBinPacker(textureWidth, textureHeight, texturePadding); const chars = [];