whale-bmfont

BMFont support module.

whale-bmfont.load(buffer)
Arguments:
Return type:

whale-core.Font()

Loads font generated with BMFont. It can be later used with whale-core.Canvas.print().

const whl = require("whale/core");
const bmfont = require("whale/bmfont");

// ...

var buffer = whl.fs.openFile("some.font").read();
var font = bmfont.load(buffer);

var canvas = new whl.Canvas(/* ... */);

canvas.print(
   "Hello World!",                    // text
   whl.translate(new whl.Vec2(0, 0)), // position
   new whl.Vec4(1, 1, 1, 1),          // color (white)
   font,                              // font
   20                                 // font line height
);