Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.push(file.clone(false));
}
// replace ext
file.path = replaceExt(file.path, '.ttf');
// ttf info
var ttfBuffer;
var ttfObj;
// try otf2ttf
try {
ttfObj = otf2ttfobject(b2ab(file.contents), opts);
ttfBuffer = ab2b(new TTFWriter(opts).write(ttfObj));
}
catch (ex) {
cb(ex);
}
if (ttfBuffer) {
file.contents = ttfBuffer;
file.ttfObject = ttfObj;
cb(null, file);
}
});
}
// replace ext
file.path = replaceExt(file.path, '.ttf');
// ttf buffer
var output;
try {
var ttfObj = svg2ttfobject(
file.contents.toString('utf-8')
);
output = ab2b(new TTFWriter(opts).write(ttfObj));
}
catch (ex) {
cb(ex);
}
if (output) {
file.contents = output;
cb(null, file);
}
});
SvgFont.prototype.compile = function () {
if (this.opts.adjust) {
this.ttf.adjustGlyfPos(null, this.opts.adjust);
this.ttf.adjustGlyf(null, this.opts.adjust);
}
this.contents = ab2b(
new TTFWriter(
this.opts
)
.write(
this.ttf.ttf
)
);
};
opts = opts || {};
var ttfobj = contents;
if (Buffer.isBuffer(contents)) {
ttfobj = new TTFReader(opts).read(b2ab(contents));
}
var miniObj = minifyFontObject(
ttfobj,
opts.subset,
opts.use
);
var ttfBuffer = ab2b(
new TTFWriter(opts).write(miniObj)
);
return {
object: miniObj,
buffer: ttfBuffer
};
}