How to use load-bmfont - 5 common examples

To help you get started, we’ve selected a few load-bmfont examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oliver-moran / jimp / packages / plugin-print / src / index.js View on Github external
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)
github davidmcclure / earthxray / src / javascripts / components / startup.js View on Github external
let font = new Promise(resolve => {
      loadFont('bm-fonts/Lato-Regular-64.fnt', (err, font) => {
        resolve(font);
      });
    });
github davidmcclure / earthxray / src / javascripts / scene / startup.js View on Github external
let font = new Promise(resolve => {
      loadFont('bm-fonts/Lato-Regular-64.fnt', (err, font) => {
        resolve(font);
      });
    });
github kinetecharts / openPerform / src / effects / performer / DataTags.js View on Github external
_.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;
          }
        });
      });
    });
  }
github socialtables / openfpc / src / lib / renderable-scene-maintainer.js View on Github external
      new Promise((res, rej) => loadFont(
        opensansFnt,
        (err, fnt) => err ? rej(err) : res(fnt))
      ),

load-bmfont

loads a BMFont file in Node and the browser

MIT
Latest version published 6 months ago

Package Health Score

70 / 100
Full package analysis

Popular load-bmfont functions