The first three bytes of the header are the file identifier and are always set to 66, 77, 70 (BMF). The fourth byte is the version which is currently 3.

After the header are a number of blocks based on the tags described above.

Field | Size | Type | Pos | Comment |
---|---|---|---|---|

fontsize | 2 | int | 0 | |

bitField | 1 | bits | 2 | bit 0:smooth bit 1:unicode bit 2:italic bit 3:bold bit 4:fixedHeight bits 5-7:reservered |

charSet | 1 | uint | 3 | |

stretchH | 2 | uint | 4 | |

aa | 1 | uint | 6 | |

paddingUp | 2 | uint | 7 | |

paddingRight | 1 | uint | 8 | |

paddingDown | 1 | uint | 9 | |

paddingLeft | 1 | uint | 10 | |

spacingHoriz | 1 | uint | 11 | |

spacingVert | 1 | uint | 12 | |

outline | 1 | uint | 13 | |

fontName | n+1 | string | 14 | null terminated string with length n |

Field | Size | Type | Pos | Comment |
---|---|---|---|---|

lineHeight | 2 | uint | 0 | |

base | 2 | uint | 2 | |

scaleW | 2 | uint | 4 | |

scaleH | 2 | uint | 6 | |

pages | 2 | uint | 8 | |

bitField | 1 | bits | 10 | bits 0-6:reserved, bit 7:packed |

Field | Size | Type | Pos | Comment |
---|---|---|---|---|

pageNames | p*(n+1) | strings | 0 | null terminated strings, each with length n |

Field | Size | Type | Pos | Comment |
---|---|---|---|---|

id | 4 | uint | 0+c*20 | these fields are repeated until all characters have been described |

x | 2 | uint | 4+c*20 | |

y | 2 | uint | 6+c*20 | |

width | 2 | uint | 8+c*20 | |

height | 2 | uint | 10+c*20 | |

xoffset | 2 | uint | 12+c*20 | |

yoffset | 2 | uint | 14+c*20 | |

xadvance | 2 | uint | 16+c*20 | |

page | 1 | uint | 18+c*20 | |

chnl | 1 | uint | 19+c*20 |

The number of characters in the file can be calculated by taking the size of the block and dividing it with the size of the charInfo structure, i.e. numChars = charsBlock.blockSize/20

]]>The first three bytes of the header are the file identifier and are always set to 66, 77, 70 (BMF). The fourth byte is the version which is currently 3.

After the header are a number of blocks based on the tags described above.

Field | Size | Type | Pos | Comment |
---|---|---|---|---|

fontsize | 2 | int | 0 | |

bitField | 1 | bits | 2 | bit 0:smooth bit 1:unicode bit 2:italic bit 3:bold bit 4:fixedHeight bits 5-7:reservered |

charSet | 1 | uint | 3 | |

stretchH | 2 | uint | 4 | |

aa | 1 | uint | 6 | |

paddingUp | 2 | uint | 7 | |

paddingRight | 1 | uint | 8 | |

paddingDown | 1 | uint | 9 | |

paddingLeft | 1 | uint | 10 | |

spacingHoriz | 1 | uint | 11 | |

spacingVert | 1 | uint | 12 | |

outline | 1 | uint | 13 | |

fontName | n+1 | string | 14 | null terminated string with length n |

Field | Size | Type | Pos | Comment |
---|---|---|---|---|

lineHeight | 2 | uint | 0 | |

base | 2 | uint | 2 | |

scaleW | 2 | uint | 4 | |

scaleH | 2 | uint | 6 | |

pages | 2 | uint | 8 | |

bitField | 1 | bits | 10 | bits 0-6:reserved, bit 7:packed |

Field | Size | Type | Pos | Comment |
---|---|---|---|---|

pageNames | p*(n+1) | strings | 0 | null terminated strings, each with length n |

Field | Size | Type | Pos | Comment |
---|---|---|---|---|

id | 4 | uint | 0+c*20 | these fields are repeated until all characters have been described |

x | 2 | uint | 4+c*20 | |

y | 2 | uint | 6+c*20 | |

width | 2 | uint | 8+c*20 | |

height | 2 | uint | 10+c*20 | |

xoffset | 2 | uint | 12+c*20 | |

yoffset | 2 | uint | 14+c*20 | |

xadvance | 2 | uint | 16+c*20 | |

page | 1 | uint | 18+c*20 | |

chnl | 1 | uint | 19+c*20 |

The number of characters in the file can be calculated by taking the size of the block and dividing it with the size of the charInfo structure, i.e. numChars = charsBlock.blockSize/20

]]>