Skip to content

Commit

Permalink
feat: Add arm64 MacOS compatibility (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
arilotter authored Jun 16, 2023
1 parent 0cb2817 commit 5a2495a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Binary file added bin/darwin_arm64/msdfgen.osx
Binary file not shown.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const controlChars = ['\n', '\r', '\t'];

const binaryLookup = {
darwin: 'msdfgen.osx',
darwin_arm64: 'msdfgen.osx',
win32: 'msdfgen.exe',
linux: 'msdfgen.linux',
linux_arm64: 'msdfgen.linux'
Expand Down Expand Up @@ -52,9 +53,11 @@ function generateBMFont (fontPath, opt, callback) {
opt = {};
}

const binName = process.arch === "arm64" ? binaryLookup[`${process.platform}_${process.arch}`] : binaryLookup[process.platform];
const lookupKey = process.arch === "arm64" ?`${process.platform}_${process.arch}` : process.platform;

assert.ok(binName, `No msdfgen binary for platform ${process.platform}.`);
const binName = binaryLookup[lookupKey];

assert.ok(binName, `No msdfgen binary for platform ${lookupKey}.`);
assert.ok(fontPath, 'must specify a font path');
assert.ok(typeof fontPath === 'string' || fontPath instanceof Buffer, 'font must be string path or Buffer');
assert.ok(opt.filename || !(fontPath instanceof Buffer), 'must specify filename if font is a Buffer');
Expand Down

0 comments on commit 5a2495a

Please sign in to comment.