sprite-extend-bmfont
v0.2.2
Published
SpriteJS [bmGlyph](https://www.bmglyph.com/) BitmapFont extend.
Downloads
8
Readme
sprite-extend-bmFont
SpriteJS bmGlyph BitmapFont extend.
How to use
Use bmGlyph to publish BitMap font.
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