Format:BMFont
| Versions | binary 1 to 3 (3 since application 1.10) |
|---|---|
| Magic | 42 4D 46 03 ('BMF', version 3) for the binary form; text form starts with 'info face=' |
| Extensions | .fnt (plus page images .png/.tga/.dds) |
| Endianness | little (Unverified: the documentation does not state it) |
| On this wiki | Facts · Code · Notes · Topics |
AngelCode's bitmap font description (.fnt) written by Bitmap Font Generator and many tools for game engines: a text form (info/common/page/char/kerning lines) or a binary form starting 'BMF' 3, five typed blocks, with glyph rectangles in one or more texture pages.
Overview
BMFont stores no outlines: a bitmap font is one or more texture pages plus a table that maps each character id (Unicode code point) to a rectangle on a page with offsets and an advance. Games (libGDX, Cocos2d, Unity assets and many custom engines) ship it as .fnt beside .png pages. Source for everything here: the AngelCode documentation (file_format.html), read 2026-10-18.
Binary form
Header: bytes 42 4D 46 ('BMF') and the version byte, which must be 3. Then blocks: 1 byte block type (1 info, 2 common, 3 pages, 4 chars, 5 kerning pairs), a 4-byte size that counts only the contents (not the type byte or size field; this changed in version 3). Version history: v2 added outline in info and encoded in common; v3 removed encoded, added the four channel fields and widened character and kerning ids to 4 bytes.
Layouts: Fact:BMFont/struct/Binary info and common blocks and Fact:BMFont/struct/Binary chars and kerning blocks. The pages block is pages null-terminated file names, all of the same length.
Text form
One line per record: info face=".." size=.. bold=.. italic=.. charset=".." unicode=.. stretchH=.. smooth=.. aa=.. padding=up,right,down,left spacing=h,v outline=.., common lineHeight= base= scaleW= scaleH= pages= packed= alphaChnl= redChnl= greenChnl= blueChnl=, page id= file="..", chars count=.., char id= x= y= width= height= xoffset= yoffset= xadvance= page= chnl=, kernings count=.., kerning first= second= amount=.
Reversing notes
- Telling the forms apart: the binary file starts with
BMFand a byte 3; the text file starts with ASCIIinfo. An XML variant also exists in tools. Unverified: XML variant details are not in the documentation read. - char id is a Unicode code point; id 0xFFFFFFFF (-1) is used for the fallback glyph in the documentation of newer versions. Unverified: not read in the page used here.
chnlis a bit set (1 blue, 2 green, 4 red, 8 alpha, 15 all) saying which texture channel holds the glyph, so several glyph sets can share one image; the common block's channel fields (0 glyph, 1 outline, 2 glyph and outline, 3 zero, 4 one) say what each channel contains.- The documentation lists the kerning amount offset as 8+c*6, which conflicts with the 10-byte record; 10 bytes is the consistent size.