Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
cb =
cb ||
function(err, font) {
if (err) reject(err);
else resolve(font);
};
bMFont(file, (err, font) => {
const chars = {};
const kernings = {};
if (err) {
return throwError.call(this, err, cb);
}
for (let i = 0; i < font.chars.length; i++) {
chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];
}
for (let i = 0; i < font.kernings.length; i++) {
const firstString = String.fromCharCode(font.kernings[i].first);
kernings[firstString] = kernings[firstString] || {};
kernings[firstString][
String.fromCharCode(font.kernings[i].second)
let font = new Promise(resolve => {
loadFont('bm-fonts/Lato-Regular-64.fnt', (err, font) => {
resolve(font);
});
});
let font = new Promise(resolve => {
loadFont('bm-fonts/Lato-Regular-64.fnt', (err, font) => {
resolve(font);
});
});
_.each(fontList, (fontDef) => {
loadFont(fontDef.json, (err, font) => {
if (err) throw err;
THREE.ImageUtils.loadTexture(fontDef.png, undefined, (texture) => {
fontDef.font = font;
fontDef.texture = texture;
if (_.filter(fontList, 'font').length === fontList.length) {
this.fontsReady = true;
}
});
});
});
}