0.0.118 • Published 3 years ago

pixi-dynamic-bitmap-fonts v0.0.118

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

pixi-dynamic-bitmap-fonts

NPM

Disclaimer

This package is very early work in progress. There will be a lot of breaking changes in future versions and hopefully an actual human-understandable readme.

For now:


Usage

const dbmf = new DynamicBitmapFonts.Manager();

/** Ref your translations object. 
 * This would typically be your localization json object,
 * filled with key-value pairs, the right side of which would be the
 * text, translated to the desired language.
 * 
 * DynamicBitmapFonts will in fact look through those values and
 * gather all unique symvbols found.
 */
dbmf.translation = myTranslationsObject;

/** Just in case, you might want to add characters, even if they aren't
 * found in the translations object.
 * 
 * Typically you'd use this if you want to have digits and perhaps the english alphabet,
 * regardless of the actual language displayed, to resolve dynamic content such as numeric values
 * and usernames.
 */

dbmf.requiredCharacters = DynamicBitmapFonts.shortcuts.CHARACTERS.ALPHANUMERIC;

/**
 * Keys would be the font name. Values -- that font's configurations.
 */
dmbf.configs = {
  "myAwesomeFont": {
    style: {
      fontFamily: 'Arial, Helvetica, sans-serif',
      fontSize: 24,
      fontWeight: 'bold',
      fill: '#FFFFFF',
    },
    options: {
      textureWidth: 1024,
      textureHeight: 1024,
      resolution: 1.0,
      padding: 1,
    },
    modifyTexture: shortcuts.modifyTextureAsPixiObject( (o) => {
      o.addTextureSpriteCopy();
      const [a,b] = o.children as PIXI.Sprite[];
      a.x -= 1;
      a.alpha = 0.5;
      a.blendMode = PIXI.BLEND_MODES.ADD;
      b.x += 1;
      a.alpha = 0.5;
      b.blendMode = PIXI.BLEND_MODES.ADD;
    })
  },
}
0.0.118

3 years ago

0.0.116

3 years ago

0.0.115

3 years ago

0.0.113

3 years ago

0.0.109

3 years ago

0.0.108

3 years ago

0.0.112

3 years ago

0.0.106

3 years ago

0.0.105

3 years ago

0.0.104

3 years ago

0.0.103

3 years ago

0.0.101

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.4-typed

3 years ago

0.0.3-typed

3 years ago

0.0.2-a

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago