Jump to content
  • Advertisement
Sign in to follow this  

BMfont binary format

This topic is 4288 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have some problems reading the info block (using BMfont 1.8b) of the binary format. The rest of the file works great. Perhaps I don't understand the layout, or is it out of sync with the documentation? Anyway these are the values I get for example, excluding the string on the end and blocksize at the begin: 32, 194, 0, 100, 0, 4, 0, 0, 0, 1, 1 All are bytes, except the first and eight number, these are WORD. I count 15 vars in the spec, some are missing here. I also expected stretchH, which should be the 8th number, to be 100. This is this specified layout. One more question, what do these ':4' and ':1' mean? #pragma pack(1) struct infoBlock { int blockSize; WORD fontSize; BYTE reserved:4; BYTE bold :1; BYTE italic :1; BYTE unicode :1; BYTE smooth :1; BYTE charSet; WORD stretchH; BYTE aa; BYTE paddingUp; BYTE paddingRight; BYTE paddingDown; BYTE paddingLeft; BYTE spacingHoriz; BYTE spacingVert; char fontName[1]; };

Share this post

Link to post
Share on other sites
I probably need to clarify the file format specs a bit in the manual.

The info block looks like this:

4 bytes : size of block
2 bytes : font size
1 byte : bitmask with flags for bold, italic, unicode, and smooth
1 byte : charset (not used if unicode)
2 bytes : horizontal stretch
1 byte : super sampling level (1 to 4)
4 bytes : padding, up, right, down, left
2 bytes : spacing, horizontal, vertical
n bytes : null terminated string with the name of the font

The :4 and :1 after some of the variables are C++ syntax for specifying how many bits the variable take up. These variables get packed into a single byte.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!