In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "BRFNT files"

From WiiBrew
Jump to navigation Jump to search
(Incomplete documentation. I'll finish it later.)
 
 
(4 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
The endianess is Big Endian.  
 
The endianess is Big Endian.  
  
=== BRFNT header ===
+
== RFNT Header ==
 
+
10h bytes
The header is 16 bytes long.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 19: Line 18:
 
|-
 
|-
 
| 0x0000
 
| 0x0000
| 4
+
|
| "RFNT" (0x52464E54)
+
| 'RFNT'
 
|-
 
|-
 
| 0x0004
 
| 0x0004
| 2
+
|
| Endian? (0xFEFF)
+
| Endian byte mark - FE FF
 
|-
 
|-
 
| 0x0006
 
| 0x0006
| 2
+
|
| Version? (0x0104)
+
| file version - 01 04
 
|-
 
|-
 
| 0x0008
 
| 0x0008
| 4
+
|
| File Size
+
| DWORD length of whole file
 
|-
 
|-
 
| 0x000C
 
| 0x000C
| 2
+
|
| Header Size? (0x0010)
+
| offset to first block - WORD
 
|-
 
|-
 
| 0x000E
 
| 0x000E
| 2
+
|
| Number of Sections?
+
| block count - WORD
 
|}
 
|}
  
=== FINF section ===
+
== FINF Header ==
 +
 
 +
20H bytes
 +
 
 +
0x0000: 'FINF'
 +
 
 +
0x0004: DWORD finf size
 +
 
 +
0x0008: BYTE ??
 +
 
 +
0x0009: BYTE font height - 1
 +
 
 +
0x000A: WORD ??
 +
 
 +
0x000C: BYTE ??
 +
 
 +
0x000D: BYTE character width or height + 1 (?)
 +
 
 +
0x000E: BYTE character height or width + 1 (?)
 +
 
 +
0x000F: BYTE 00 (?)
 +
 
 +
0x0010: DWORD TGLP section position
 +
 
 +
0x0014: DWORD CWDH section position
 +
 
 +
0x0018: DWORD CMAP section position
 +
 
 +
0x001C: BYTE font height - 1 (excluding left line?)
 +
 
 +
0x001D: BYTE font width - 1 (excluding bottom line?)
 +
 
 +
0x001E: BYTE character width or height - 1 (?)
 +
 
 +
0x001F: BYTE 00 (?)
 +
 
 +
== TGLP Header ==
 +
 
 +
30h bytes
 +
 
 +
0x0000: 'TGLP'
 +
 
 +
0x0004: DWORD length of 'TGLP' section
 +
 
 +
0x0008: BYTE font width - 1
 +
 
 +
0x0009: BYTE font height - 1
 +
 
 +
0x000A: BYTE character width - 1
 +
 
 +
0x000B: BYTE character height - 1
 +
 
 +
0x000C: DWORD length of 1 image
 +
 
 +
0x0010: WORD images count
 +
 
 +
0x0012: WORD Tpl Type
 +
 
 +
0x0014: WORD characters per row
 +
 
 +
0x0016: WORD characters per column
 +
 
 +
0x0018: WORD width of image
 +
 
 +
0x001A: WORD height of image
 +
 
 +
0x001C: DWORD position of data
 +
== TGLP Data ==
 +
 
 +
Bitmap is formed in a Zig-zag way.
 +
 
 +
A single block of bitmap looks like this:
 +
 
 +
00 01 02 03 04 05 06 07
 +
 
 +
08 09 0A 0B 0C 0D 0E 0F
 +
 
 +
10 11 12 13 14 15 16 17
 +
 
 +
18 19 1A 1B 1C 1D 1E 1F
 +
 
 +
Multiple blocks:
 +
 
 +
B01 B02 B03 ... B08 (assume width=64)
 +
 
 +
B09 B0A B0B ...
 +
 
 +
...
 +
 
 +
Multiple images:
 +
 
 +
I01
 +
 
 +
I02
 +
 
 +
I03
 +
 
 +
...
 +
 
 +
== CWDH Section ==
 +
 
 +
0x0000: 'CWDH'
 +
 
 +
0x0004: DWORD length of this section
 +
 
 +
0x0008: DWORD last character ? (= character count - 1)
 +
 
 +
0x000C: DWORD first character ? (= 0)
 +
 
 +
0x0010: character count * (
 +
 
 +
BYTE space width ?
 +
BYTE character width
 +
BYTE smaller than character width )
 +
????: (0~3) * 00 (align to 4 bytes)
 +
 
 +
== CMAP Section ==
 +
 
 +
=== Type 1 ===
 +
 
 +
0x0000: ‘CMAP’
 +
 
 +
0x0004: DWORD length of this section
 +
 
 +
0x0008: WORD UTF-16 code of first char
 +
 
 +
0x000A: WORD UTF-16 code of last char
 +
 
 +
0x000C: DWORD 0 ?
 +
 
 +
0x0010: DWORD position of next CMAP + 8
 +
 
 +
0x0014: WORD offset of first char
 +
 
 +
0x0016: WORD ?
 +
 
 +
=== Type 2 ===
  
Contains font information. 32 bytes long.
+
0x0000: ‘CMAP’
  
{| class="wikitable"
+
0x0004: DWORD length of this section
! Offset
+
 
! Size
+
0x0008: WORD 0
! Description
+
 
|-
+
0x000A: WORD -1
| 0x0000
+
 
| 4
+
0x000C: 00 02 00 00 ?
| "FINF" (0x46494E46)
+
 
|-
+
0x0010: DWORD position of next CMAP + 8 (0 if no next)
| 0x0004
+
 
| 4
+
0x0014: WORD characters in this table (tbl_char count)
| Size of this section (bytes from section beginning)  
+
 
|}
+
0x0016: tbl_char count * (
 +
 
 +
WORD UTF-16 code of char
 +
WORD offset of char )
 +
????: WORD 0
 +
 
 +
[[Category:File formats]]

Latest revision as of 10:15, 16 November 2014

This is incomplete.

Stores images of characters used to display text. Can be found in Mario Kart Wii and possibly others.

The file structure is composed by a header and sections. There always appears to be a FINF, TGLP and CWDH section along with one or more CMAP sections.

The file is not completely known.

The endianess is Big Endian.

RFNT Header

10h bytes

Offset Size Description
0x0000 'RFNT'
0x0004 Endian byte mark - FE FF
0x0006 file version - 01 04
0x0008 DWORD length of whole file
0x000C offset to first block - WORD
0x000E block count - WORD

FINF Header

20H bytes

0x0000: 'FINF'

0x0004: DWORD finf size

0x0008: BYTE ??

0x0009: BYTE font height - 1

0x000A: WORD ??

0x000C: BYTE ??

0x000D: BYTE character width or height + 1 (?)

0x000E: BYTE character height or width + 1 (?)

0x000F: BYTE 00 (?)

0x0010: DWORD TGLP section position

0x0014: DWORD CWDH section position

0x0018: DWORD CMAP section position

0x001C: BYTE font height - 1 (excluding left line?)

0x001D: BYTE font width - 1 (excluding bottom line?)

0x001E: BYTE character width or height - 1 (?)

0x001F: BYTE 00 (?)

TGLP Header

30h bytes

0x0000: 'TGLP'

0x0004: DWORD length of 'TGLP' section

0x0008: BYTE font width - 1

0x0009: BYTE font height - 1

0x000A: BYTE character width - 1

0x000B: BYTE character height - 1

0x000C: DWORD length of 1 image

0x0010: WORD images count

0x0012: WORD Tpl Type

0x0014: WORD characters per row

0x0016: WORD characters per column

0x0018: WORD width of image

0x001A: WORD height of image

0x001C: DWORD position of data

TGLP Data

Bitmap is formed in a Zig-zag way.

A single block of bitmap looks like this:

00 01 02 03 04 05 06 07

08 09 0A 0B 0C 0D 0E 0F

10 11 12 13 14 15 16 17

18 19 1A 1B 1C 1D 1E 1F

Multiple blocks:

B01 B02 B03 ... B08 (assume width=64)

B09 B0A B0B ...

...

Multiple images:

I01

I02

I03

...

CWDH Section

0x0000: 'CWDH'

0x0004: DWORD length of this section

0x0008: DWORD last character ? (= character count - 1)

0x000C: DWORD first character ? (= 0)

0x0010: character count * (

BYTE space width ? BYTE character width BYTE smaller than character width ) ????: (0~3) * 00 (align to 4 bytes)

CMAP Section

Type 1

0x0000: ‘CMAP’

0x0004: DWORD length of this section

0x0008: WORD UTF-16 code of first char

0x000A: WORD UTF-16 code of last char

0x000C: DWORD 0 ?

0x0010: DWORD position of next CMAP + 8

0x0014: WORD offset of first char

0x0016: WORD ?

Type 2

0x0000: ‘CMAP’

0x0004: DWORD length of this section

0x0008: WORD 0

0x000A: WORD -1

0x000C: 00 02 00 00 ?

0x0010: DWORD position of next CMAP + 8 (0 if no next)

0x0014: WORD characters in this table (tbl_char count)

0x0016: tbl_char count * (

WORD UTF-16 code of char WORD offset of char ) ????: WORD 0