http://www.angelcode.com/products/bmfont/
fits the bill, exactly except the output *.fnt format does not work with irrlicht so, created this utility to convert the bmFont ".fnt" font file (xml setting in export options) output to an Irrlicht ".xml" font file.
http://www.mediafire.com/download.php?pad4dr799dqeduz
it takes a single argument <filename>.fnt and creates a file <filename>.xml that should work with irrlicht. It will handle multiple bitmaps too.
All well and good upto now, but hang on bmfont being very clever does a best fit on the font glyphs, to reduce the space used in the bitmaps. But Irrlicht doesn't support variable height font glyphs, Doh ! Well unless you hack the source....
CGUIFont.h
modify SFontArea struct to this
Code: Select all
struct SFontArea
{
SFontArea() : underhang(0), overhang(0), width(0), spriteno(0), voffset(0) {}
s32 underhang;
s32 overhang;
s32 width;
s32 voffset;
u32 spriteno;
};
add
Code: Select all
a.voffset = xml->getAttributeValueAsInt(L"v");
Code: Select all
a.overhang = xml->getAttributeValueAsInt(L"o");
Code: Select all
s32 saveYoffset = offset.Y;
Code: Select all
core::array<core::position2di> offsets(text.size());
Code: Select all
offset.Y = saveYoffset;
Code: Select all
wchar_t c = text[i];
Code: Select all
offset.Y += area.voffset;
Code: Select all
offset.X += area.underhang;
anyway use it, don't use it, have a cup tea, whatever
a quick addendum:
though both bmfont & irrlicht font tool use px to define font size the following formula will match sizes
irrlicht = bmfont * 72 / 96
the 72/96 is generalized, if you have wacky screen settings it probably won't work.