Transition to @napi-rs/canvas

This commit is contained in:
Dragon Fire
2024-05-03 01:13:32 -04:00
parent 0c9253fe75
commit b504764ba2
173 changed files with 333 additions and 333 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
const { registerFont } = require('canvas');
const { GlobalFonts } = require('@napi-rs/canvas');
const weights = {
100: 'thin',
200: 'extraLight',
@@ -28,7 +28,7 @@ module.exports = class Font {
register() {
if (this.registered) return null;
this.registered = true;
return registerFont(this.path, { family: this.filenameNoExt, style: this.style, weight: this.weight });
return GlobalFonts.registerFromPath(this.path, this.filenameNoExt);
}
toCanvasString(size, shouldDoFallbacks = true) {