sprite-extend-bmfont

0.2.2 • Public • Published

sprite-extend-bmFont

SpriteJS bmGlyph BitmapFont extend.

How to use

Use bmGlyph to publish BitMap font.

bmGlyph

Choose publish format cocos2d/BMFont.

Use tools/generate.js to generate bmfont file for SpriteJS

node tools/generate.js fonts/testsprite.fnt
  <script src="https://unpkg.com/spritejs/dist/spritejs.min.js"></script> 
  <script src="https://s4.ssl.qhres.com/!d41bc226/sprite-extend-bmfont.js"></script> 
  <script src="/js/sprite.fnt.js"></script> 
  <script>
    const context = document.getElementById('container').getContext('2d')
    const {Layer, BMFont, Label} = spritejs
 
    const layer = new Layer({context})
    const s = new BMFont()
    s.attr({
      anchor: 0.5,
      fontFace: 'Arial',
      text: 'SpriteJS\nabVu',
      pos: [300, 200],
      border: {
        width: 4,
        color: 'red',
      },
      // lineHeight: 30,
      // letterSpacing: 20,
      textAlign: 'center',
    })
    layer.append(s)
  </script> 

Arguments of generate.js

** build for weixin **

node generate.js fonts/testsprite.fnt --weixin

Copy testsprite.png to /assets/img/testsprite.png

** build with online texture **

node generate.js fonts/testsprite.fnt --src=https://p4.ssl.qhimg.com/t016ec624e084e49c16.png

** build with preload resource id **

node generate.js fonts/testsprite.fnt --id=testsprite.png

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.2.25latest

Version History

VersionDownloads (Last 7 Days)Published
0.2.25
0.2.10
0.2.00
0.1.00

Package Sidebar

Install

npm i sprite-extend-bmfont

Weekly Downloads

5

Version

0.2.2

License

MIT

Unpacked Size

1.28 MB

Total Files

19

Last publish

Collaborators

  • akira_cn