Halo 2 Font

User avatar
Click16
Posts: 1941
Joined: Mon Dec 31, 2007 4:36 am
Location: United States

Halo 2 Font

Post by Click16 »

As many of you know, the in game font includes all of the weapon symbols, medals, and controller buttons. Is there a way to extract, or edit these images?
Image
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Re: Halo 2 Font

Post by XZodia »

Yes. But I don't know what it is.
But if no program exists I might make one...
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
Click16
Posts: 1941
Joined: Mon Dec 31, 2007 4:36 am
Location: United States

Re: Halo 2 Font

Post by Click16 »

How exactly can one go about doing this? I would like to make something that can do it. Perhaps we could talk on AIM...
Image
User avatar
Grimdoomer
Admin
Posts: 1835
Joined: Sun Dec 09, 2007 9:09 pm

Re: Halo 2 Font

Post by Grimdoomer »

I made a topic about this a very long time ago. Jackson and myself took a stab at the file with no success. I can tell you that the font files were not generated by any of the xbox 1 sdk font tools. It could be a custom file format for all I know. But good luck, would make a badass unicode editor.
Don't snort the magic, we need it for the network.
User avatar
CaptainPoopface
Posts: 714
Joined: Sat Feb 16, 2008 5:47 am

Re: Halo 2 Font

Post by CaptainPoopface »

I always wanted to be able to change the weapon icon in the text for custom weapons and such. That would be nice to be able to do.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

The font files seem to have an index at 0x40400 in the format:

Code: Select all

  object IndexListing
    short unknown1;
    short size;       // Size of raw data
    short unknown3;
    short unknown4;
    short unknown5;   // Block count of some sort?
    short unknown6;
    int offset;       // Offset to raw data
   End;
The last index offset + size = end of the file

As for the first 263,168 bytes, meh. It seems to be mostly "F8 01 00 00" repeating over and over...
How that translates to this though:
Image
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Re: Halo 2 Font

Post by XZodia »

Its probably a bitmap font...the letter images aren't defined anywhere in the maps are they? If so they should be in there too.
Each entry in the index is likely one character/image.
The images themselves may be in a different file.
"F8 01 00 00 F8 01 00 00" might be an unused index character, to allow for special characters from each language.
Could someone upload all the files related to the font for me please (all languages)?
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

Here ya go:
http://www.remnantmods.com/archive/misc ... 2Fonts.rar

EDIT: Forgot, it also has some Pascal programs I threw togther for testing purposes. The TEXTINFO reads the 0x40400 index and shows the values, the TEXTDATA shows the first offset from the index graphically in pixels, although nothing stood out to me.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

Does the game load without any/all of the font files?
If so, are the same fonts displayed?
Anyone tried this?
User avatar
OwnZ joO
Posts: 1197
Joined: Sun Dec 09, 2007 4:46 pm

Re: Halo 2 Font

Post by OwnZ joO »

I want to say it gives a dirty disc error without the right fonts, but I can't remember for sure and don't have a box to test with atm.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

Did some playing around tonight & found the following for the "font_Table.txt" listing:

Code: Select all

1)	fixedsys-9		
2)	conduit-12		Popup menus (in & out of game) except TL description, Game desc/options box, Button desc
3)	handel_gothic-11	Popup menus description, "PRESS START TO CONTINUE"
4)	handel_gothic-24	"LOADING 13%" (w/ no intro movie)
5)	conduit-13		Split screen sign-in names & "Press A...", Matchmaking names, "Start Game"/"Settings" & Quick Options
6)	conduit-12		???
7)	conduit-13		In game: messages ([x] to pickup [br]), score names, ammo
8)	conduit-12		??? split-screen In game: messages ([x] to pickup [br]), score names, ammo ???
9)	MSLCD-14		??? (maybe for DD errors ??)
10)	conduit-16		???
11)	handel_gothic-13	Main screen menu
The numbers on the left are entry numbers; H2 ignores blank lines.
If you only keep the first font and delete the rest, the button images do not show ("A" & "B" and assuming weapons as well in game), however ANY font placed in entry 2 will show them, so unless every font contains them...
User avatar
CaptainPoopface
Posts: 714
Joined: Sat Feb 16, 2008 5:47 am

Re: Halo 2 Font

Post by CaptainPoopface »

How would one replace or change the conduit-12 and conduit-13 fonts? Not just making the font but putting it in whatever place it would be read from? I don't think I've seen an animated font (the bouncing joystick image) except in Halo 2.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

Not totally sure what you mean, but it looks like you can choose each displayed font for the menus under:
Panels[32]\Text Blocks[28]\Custom Font[10]

For example, "[wgit] start_screen" has 2 entries. The first is for the build and the second is for the "PRESS START TO CONTINUE" that flashes under the Halo 2 emblem on the first screen. This entry has a custom font of 2, which corresponds to the third entry in the "font_table.txt" listing.
So if you just wanted that item to use a different font, you could just change the Custom Font number to one of the other lines in the file.

I think as others have stated, that the buttons, weapons, joyticks, etc are built into the XBE.
User avatar
Grimdoomer
Admin
Posts: 1835
Joined: Sun Dec 09, 2007 9:09 pm

Re: Halo 2 Font

Post by Grimdoomer »

troymac1ure wrote:Not totally sure what you mean, but it looks like you can choose each displayed font for the menus under:
Panels[32]\Text Blocks[28]\Custom Font[10]

For example, "[wgit] start_screen" has 2 entries. The first is for the build and the second is for the "PRESS START TO CONTINUE" that flashes under the Halo 2 emblem on the first screen. This entry has a custom font of 2, which corresponds to the third entry in the "font_table.txt" listing.
So if you just wanted that item to use a different font, you could just change the Custom Font number to one of the other lines in the file.

I think as others have stated, that the buttons, weapons, joyticks, etc are built into the XBE.
No they are not in the xbe, they were never in the xbe, and will never be in the xbe. The images are in those exact fonts you are messing around with.
Don't snort the magic, we need it for the network.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

Just looking at the fonts again (not much time right now) but found an index table inside. If anyone else is interested look at handel_gothic-24 at position 0x040400 is an index table. Each index is 16 bytes long. Like I said I just found this, so not much info other than the last four bytes (it seems) are the offset to each character in the table (starting at the end of the table which points almost to the end of the file).
Example (First few entries):

Code: Select all

08 00 01 00 │ 01 00 24 00 │ 00 00 1D 00 │ 40 2A 04 00
07 00 0B 00 │ 05 00 24 00 │ 02 00 1D 00 │ 41 2A 04 00
0B 00 1C 00 │ 09 00 24 00 │ 02 00 1D 00 │ 4C 2A 04 00
15 00 60 00 │ 15 00 24 00 │ 00 00 1D 00 │ 68 2A 04 00
I assume the others probably contain width & height info in there somewhere at least. Food for thought anyways...

EDIT:
The index table seems to always start at 0x40400 (although there are ?empty? entries above that)

Code: Select all

Byte 0/1  ???
Byte 2/3  number of bytes used
Byte 4/5  width of the character
Byte 6/7  height of the character
Byte 8/9  Type ? (Appears to usually be -1,0,1,2,3 although I have seen 5 and -3 as well)
Byte A/B  ???
Byte C/D/E/F  Offset to data
Either the filenames are listing the fonts in hex size or in this case handel_gothic-24 is a 24 pixel height with 4 pixels padding above / below to make 0x24 (32 decimal)?
It appears there are 258 entries of the given font height, followed by differentiating font widths AND heights (assuming this is the symbols, such as 10x10, 2Dx13, 10x12, 26x13, etc)
Not totally sure why 258, but these may likely align with our current ascii tables (for letters anyways).
May need to try playing with some values and see if it changes what I think it will...
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

So to add to the info above, I discovered how to change colors within each character.

If anywhere in the character data it comes across a 00 code, the following 2 bytes will change the color given the bit values A1R5B5G5, but the A1 (MSB) seems to have no effect).
I haven't done alot of testing to discover locations of each character, but I know that the 5th character is "%" :wink:
User avatar
JacksonCougar
Huurcat
Posts: 2460
Joined: Thu Dec 06, 2007 11:30 pm
Location: Somewhere in Canada

Re: Halo 2 Font

Post by JacksonCougar »

Cool :D keep us updated. From a data perspective the chars in the map-files relating the the bitmap images (A button, B button, etc) are valid UTF8, they are just in an unused (kinda) range of the unicode values.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

Don't know when I'll get a chance to look at this in depth again, but I was thinking after I went to bed that theer seems to be alot of 3F values I think. I am wondering if it lists a stepping value (possibly allowing forward and backward stepping?.) Anyways, just random thoughts that require more testing.

Also, if anyone wants to play with changing the font file, forget u/l to the halo directory, just u/l to the cache folder instead.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

I think I've figured out all of the font file format (except the first 0x3FF bytes). I still need to do some verifications, but this is my idea:

Code: Select all

0x400 = Table of available UTF-8 Codes (Always 0x40000 in size, each entry is 0x04 bytes in size, giving 65536 possible entries)
	* Each entry points to a location in the index table
	* 01 FE (510 / -2) = no character available
	
0x40400 = Index table (Each entry is 0x10 (16) bytes)
	Byte 0x00:	(short)	Character Width?
	Byte 0x02:	(short)	Number of bytes used
	Byte 0x04:	(short)	Width of byte runs
	Byte 0x06:	(short)	Height of the byte runs
	Byte 0x08:	(short)	Type ? (Appears to usually be -1,0,1,2,3 although I have seen 5 and -3 as well)
	Byte 0x0A:	(short)	???
	Byte 0x0C:	(int32)	Offset to data
(Using handel_gothic-24 again...)
In ASCII/UTF-8, the 37 character is %. There are no entries for the first 31 ASCII entries in this font, so entry 0 is ASCII #32 (space) and entry 5 is ASCII #37 (%) which aligns with what I found.
So if this table is loaded and UTF-8 corresponded accordingly, you can easily discover where the data is for each character in the font file. As for the first 0x3FF bytes, maybe that's something to do with the symbols used in H2.

That's all for now, TroyMac1ure out.
Last edited by troymac1ure on Sun Feb 17, 2013 6:27 am, edited 1 time in total.
User avatar
Grimdoomer
Admin
Posts: 1835
Joined: Sun Dec 09, 2007 9:09 pm

Re: Halo 2 Font

Post by Grimdoomer »

Here is a character mapping I made a while ago:

Code: Select all

0xFF - 0xB2 null
0xB1 push right thumbstick 2
0xB0 push right thumbstick 1
0xAF push right thumbstick 0
0xAE push left thumbstick 2
0xAD push left thumbstick 1
0xAC push left thumbstick 0
0xAB smg long barrel
0xAA plasma rifle
0xA9 sentinal beam bomb
0xA8 sentinal beam burst
0xA7 sentinal beam full auto
0xA6 sentinal beam
0xA5 desintigrator
0xA4 beam rifle
0xA3 sniper rifle
0xA2 smg
0xA1 shotgun
0xA0 rocket launcher
0x9F energy sword
0x9E plasma rifle
0x9D plasma pistol
0x9C skull
0x9B needler
0x9A magnum
0x99 wierd sentinal thing
0x98 flame thrower
0x97 fuel rod cannon
0x96 flag
0x95 carbine
0x94 brute shot
0x93 bomb
0x92 battle rifle
0x91 right thumbstick 0
0x90 left thumbstick 0
0x8F right thumbstick 2
0x8E left thumbstick 2
0x8D back button
0x8C start button
0x8B dpad right
0x8A dpad left
0x89 dpad down
0x88 dpad up
0x87 right trigger
0x86 left trigger
0x85 white button
0x84 black button
0x83 y
0x82 x
0x81 b
0x80 a
0x7F null
0x7E ~
0x7D }
0x7C |
0x7B {
0x7A z
0x79 y
0x78 x
0x77 w
0x76 v
0x75 u
0x74 t
0x73 s
0x72 r
0x71 q
0x70 p
0x6F o
0x6E n
0x6D m
0x6C l
0x6B k
0x6A j
0x69 i
0x68 h
0x67 g
0x66 f
0x65 e
0x64 d
0x63 c
0x62 b
0x61 a
0x60 `
0x5F _
0x5E ^
0x5D ]
0x5C \
0x5B [
0x5A Z
0x59 Y
0x58 X
0x57 W
0x56 V
0x55 U
0x54 T
0x53 S
0x52 R
0x51 Q
0x50 P
0x4F O
0x4E N
0x4D M
0x4C L
0x4B K
0x4A J
0x49 I
0x48 H
0x47 G
0x46 F
0x45 E
0x44 D
0x43 C
0x42 B
0x41 A
0x40 @
0x3F ?
0x3E >
0x3D =
0x3C <
0x3B ;
0x3A :
0x39 9
0x38 8
0x37 7
0x36 6
0x35 5
0x34 4
0x33 3
0x32 2
0x31 1
0x30 0
0x2F /
0x2E .
0x2D -
0x2C ,
0x2B +
0x2A *
0x29 )
0x28 (
0x27 '
0x26 &
0x25 %
0x24 $
0x23 #
0x22 "
0x21 !
0x20  
0x1F null
0x1E null
0x1D null
0x1C null
0x1B null
0x1A null
0x19 null
0x18 null
0x17 null
0x16 null
0x15 null
0x14 null
0x13 null
0x12 null
0x11 null
0x10 null
0x0F null
0x0E null
0x0D \n
0x0C null
0x0B null
0x0A null
0x09 \r
0x08 null
0x07 null
0x06 null
0x05 null
0x04 null
0x03 null
0x02 null
0x01 null
Corresponds with what you found.
Don't snort the magic, we need it for the network.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

So I've made some partial success in that I've been able to completely decode arial-13, fixedsys-9 and parts of other fonts.
The encoding is strange and I haven't discovered enough "codes" to figure out whether it's bit encoded or mapped against a table.

For example, here are some codes:

Code: Select all

0x81 = Skip 1, Draw 4
0x82 = Skip 1, Draw 3
0x83 = Skip 1, Draw 2
0xBC = Draw 1, Skip 5
0xBD = Draw 1, Skip 4
0xBE = Draw 1, Skip 3
0xBF = Draw 1, Skip 2
These are known for sure and I have others I think are right, but there are many more still...
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

Originally I was decoding in Turbo Pascal for DOS (easier to work with pixel drawing as I can view after each pixel is drawn) and now I've ported what I have over to C#.
Here's some screenshots of what I got so far. The YELLOW/GREY rectangles are blank areas (not sure why, eventually I'll look into this) and the RED rectanges are the icons that are still left improperly drawn. Judging by the changing of colors, I assume these are likely the "X","A","B","Y" buttons and such.
Image
Image
User avatar
JacksonCougar
Huurcat
Posts: 2460
Joined: Thu Dec 06, 2007 11:30 pm
Location: Somewhere in Canada

Re: Halo 2 Font

Post by JacksonCougar »

Awesome :D, care to share the source so others can poke around too?
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Font

Post by troymac1ure »

No problem, although I need to overhaul a bit first. I could make the codes external so anyone can edit them.
I need to comment my code a bit and then figure out which codes are good and which are (incorrect) guesses. This may help me track down a pattern as well. Right now I have a massive list of codes in a switch statement and I can't completely remember which are good ones :oops:

I'm working on the arial-14 font right now as some of those letters are good and others are possibly close enough to help me discover more codes. The more I get the more other characters will fall into line as well..
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Re: Halo 2 Font

Post by XZodia »

OMG I so want to change the game's font's right now.
And/Or export them to Unity =P
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
Post Reply