BNCMP Files (jnlib character map) store character mapping information for fonts. These provide the mapping information required to map character code points to glyphs in a BNFR File.
Version 1.1#
Version 1.1 predates version 1.2. Its header takes on the following structure:
Offset | Type | Meaning |
---|---|---|
0x00 | char[4] | Signature ("JNCM") |
0x04 | u16 | Version (0x0101 for 1.1) |
0x06 | u16 | Number of code points |
Following the header is a direct mapping block. This consists of a sorted (ascending) array of code points as u16. A code point at index n will be mapped to a glyph index n in its accompanying BNFR. The length of this array is the number of code points specified in the header.
Version 1.2#
Version 1.2 is the version of the file format that is used in the DS firmware program. Its header is identical in structure to that of version 1.1, but with the version field of the header updated to 1.2 (0x0102). Following the file header is the character mapping info:
Offset | Type | Meaning |
---|---|---|
0x00 | u32 | Offset to continuous character mapping info (relative to this struct) |
0x04 | u32 | Offset to direct character mapping info (relative to this struct) |
The continuous character mapping info takes the following structure:
Offset | Type | Meaning |
---|---|---|
0x00 | u16 | Number of continuous mapping blocks |
This is followed by an array of continuous mapping blocks:
Offset | Type | Meaning |
---|---|---|
0x00 | u16 | Starting code point |
0x02 | u16 | Ending code point (inclusive) |
The direct mapping block takes on the following structure:
Offset | Type | Meaning |
---|---|---|
0x00 | u16 | Number of entries |
0x02 | u16[...] | Array of code points |
The direct mapping block here lists code points in ascending order. Code points are mapped to glyphs by first checking the continuous mapping blocks, then checking the direct mapping block. If there are 50 code points mapped in continuous mapping blocks, for example, then the direct mapping block lists code points assigned to glyph indices 50 and above.