Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
__processFontFile : function(filename, resolve, reject) {
fontkit.open(filename, null, function(err, font) {
if (err) {
reject(err);
return;
}
let resources = {};
// If we have a mapping file, take this information instead
// of anaylzing the font.
if (this.getMapping()) {
let mapPath = path.join(this.__library.getRootDir(), path.join(this.__library.getResourcePath(), this.getMapping()));
fs.readFile(mapPath, {encoding: "utf-8"}, (err, data) => {
if (err) {
log.error(`Cannot read mapping file '${mapPath}': ${err.code}`);
reject(err);
return;