All posts in Tutorial

Angel Code’s BMFont plugin for enchant.js

In Alien Bio Lab, the HTML5 game we are currently working on, we use a bitmap font for our score label.

Enchant.js has a bitmap font plugin called draw.text.js, but I find it to be too strict, having to format the font atlas to be exactly like the one in the example.

I don’t want to do this manually (who does?), and usually I’d go with my¬†favorite¬†bitmap font creator, Angel Code’s BMFont.

BMFont is very easy to use, popular and supported by many engines, as far as I’ve seen. So I think it would be nice if we have a plugin that will let enchant.js support this as well.

Based on draw.text.js, I’ve created bmfont.enchant.js, a plugin that will let you use a bitmap font generated from BMFont in your enchant.js application. Since the plugin use xmlparser to parse the font information, you have to test it on your local or non-local server, otherwise it won’t be able to load the xml file.

It’s still an alpha version so I’m sure there’s a lot of room for improvement. I’ll add text alignment in the next version, but if anyone would like to add anything or modify it, feel free to use it in anyway you want!