Race Fonts (*.fnt files)

Race Fonts (*.fnt files); support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6137
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Race Fonts (*.fnt files)

Post by thunderchero » Sat Feb 13, 2010 8:52 pm

Here is a great post by pigman


Hi anyone interested in using new fonts within BOTF

May have cracked this one.

Each empire has 4 font files, but the 9 pt font can be ignored as it contains race colour and is used on map screen (unless you want to change colour, that is). Sadly, can't change colour on the larger fonts, (I think 15 pt, 20 pt and 28 pt) as these are just grey and colour is added elsewhere within BOTF.

=> changing colors of race fonts / map-grids


Thought I'd do a little tutorial on this now that I've had success.

I have assumed that you will be able to use Winrar or similar to extract font files from stbof.res and after editing can then return them to same.

Have also assumed you can use a hex editor and a suitable graphics package to edit TGA graphics files.

Step 1

Having already extracted the fonts (all have file extension .FNT), you will need to open the font that you want to edit with your hex editor. Having done that you highlight the bytes that need removing from the file in order to be able to edit it in a graphics package.

Image

Confirm delete and ignore warning about change of file size.

Step 2

Save your edited file , but with a TGA file extension!

Image

Your original FNT file will be unchanged.

Step 3

Now you can edit the file in a graphics package. I'm using Photoshop Elements 2.0 as it can save TGA files in 16 bit.

Image

You can now select a font from the text input part of your graphics package and can type onto the free black area of the graphics file.

I believe that the brightness of the characters is then reflected into the way BOTF displays the fonts, so I set the colour to grey at 90 % brightness. You can experiment as you wish. You can also try using colours. I haven't tried this yet as BOTF colours the fonts anyway, in the game and may just override your colours, or even crash the game.

Step 4

Image

You can the cut and paste your new characters into their corresponding slots. Be careful not to overlap any of the outline/grid. The fun will be finding narrow enough fonts to fit in the spaces and you can't change the width of the boxes...I've tried!

You then save this file as a 16 bit TGA file (BOTF doesn't like TGAs of any other bit depth).



Step 5

Now some more hex editing. You need to put back the bytes removed in the first step.

Image

Open both the original FNT file in your hex editor and the TGA file in same editor. You need to copy the bytes removed originally, from the FNT file, and then paste insert them back into the beginning of your edited TGA file.

Now save with the original font name and make sure you change extension to FNT.

You will now have a new font that you can Winrar back into stbof.res and away you go.

Here is the result using Aurora Bold Condensed on my new Gorn interface.

Image

Hope this is useful to all you modders out there.

Regards

Pigman
Last edited by thunderchero on Sat Feb 13, 2010 9:15 pm, edited 1 time in total.

User avatar
Axis
Lieutenant-Commander
Lieutenant-Commander
Posts: 145
Joined: Sun Aug 16, 2015 8:28 am

Re: Race Fonts (*.fnt files)

Post by Axis » Mon Feb 08, 2016 8:45 am

Is it possible to increase the size of fonts?

Like : 15 to 20, 20 to 25 and 28 to 30 or something?

15 to 20 is quite simple, just rename the fonts.

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6137
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: Race Fonts (*.fnt files)

Post by thunderchero » Mon Feb 08, 2016 10:17 am

Axis wrote:Is it possible to increase the size of fonts?

Like : 15 to 20, 20 to 25 and 28 to 30 or something?

15 to 20 is quite simple, just rename the fonts.
yes it is possible, but not easy.

I have never attempted it though.

from what I understand the basic steps would be...

1. make new 16bit tga that is formatted like this image just larger
tga.jpg
tga.jpg (101.77 KiB) Viewed 4257 times
2. next the fun part hex editing location index, the index is the first 108 bytes

not sure the format but it has

number of entries
height and width of full tga
then for each entry has height and width of entries, and location of each entry

then you would need to hex add the location index back to new tga file and save as .fnt

exact format of index is very important or you will get misalignment or wrong letter used

next problem is using new file mostly this is editing wdf files, but some are also called by trek.exe

User avatar
Axis
Lieutenant-Commander
Lieutenant-Commander
Posts: 145
Joined: Sun Aug 16, 2015 8:28 am

Re: Race Fonts (*.fnt files)

Post by Axis » Mon Feb 08, 2016 10:43 am

OK.

Sounds quite difficult.

I already started an easier way, I just made those *28's fonts higher (up to max height), and now I'm resizing the *20's fonts in the *28's slots, and renaming it to *20.fnt.

So, I'll have what I wanted.

User avatar
Axis
Lieutenant-Commander
Lieutenant-Commander
Posts: 145
Joined: Sun Aug 16, 2015 8:28 am

Re: Race Fonts (*.fnt files)

Post by Axis » Mon Feb 08, 2016 12:39 pm

So...

It wasn't as easy as I thought, after adding the normal letters (not the capitals), the UE complained about "invalid image" and the game didn't respond.

Could it be possible to somehow combine the data from *20.fnt and *28.fnt, so you could have all the letters?

I think it might be half easy/difficult.

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6137
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: Race Fonts (*.fnt files)

Post by thunderchero » Mon Feb 08, 2016 1:59 pm

Axis wrote:It wasn't as easy as I thought, after adding the normal letters (not the capitals), the UE complained about "invalid image" and the game didn't respond.
1. tga must be saved as 16 bit tga
2. after editing tga you must add back header to tga file with hex editor (first 108 bytes)
3. headers can not be swapped between 20.fnt and 28.fnt
4. size of green boxes can not be changed with out hex editing header

User avatar
Axis
Lieutenant-Commander
Lieutenant-Commander
Posts: 145
Joined: Sun Aug 16, 2015 8:28 am

Re: Race Fonts (*.fnt files)

Post by Axis » Tue Feb 09, 2016 1:13 am

1. done right.
2. done right too.
3. haven't tried.
4. underway.
5. and here comes the problem :
Fontshex.jpg
Fontshex.jpg (556.04 KiB) Viewed 4238 times
Those human15.fnt and human20.fnt are originals, and that human28.fnt is edited by me, with a new tga added.

I hope you see, (first row) at 0 seems to be the height of the font, then (at 2) comes something I don't understand, then at 4 is 0A (all fonts have it).
At 6 is the number of letterboxes (hex 78, or 120 decimal), 8 is width of the image (.tga), at A height. Then comes the second unknown value at C.

The rest is similar with the other files, until we come to the .tga file.

Here's the letterboxes widths too, 120 of them :
Letterwidths.jpg
Letterwidths.jpg (401.86 KiB) Viewed 4238 times

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6137
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: Race Fonts (*.fnt files)

Post by thunderchero » Tue Feb 09, 2016 8:21 pm

Axis wrote:(first row) at 0 seems to be the height of the font, then (at 2) comes something I don't understand, then at 4 is 0A (all fonts have it).
At 6 is the number of letterboxes (hex 78, or 120 decimal), 8 is width of the image (.tga), at A height. Then comes the second unknown value at C.

The rest is similar with the other files, until we come to the .tga file.
file structure is everything. :wink:

I took a quick look here is what I started

0x000000 29 start point down pixels of first box
0x000001 1 start point right pixels of first box (9.fnt set to 0?)
0x000002 773
or
0x000002 5
0x000003 3
0x000004 10
0x000006 120 total entries (green boxes)
0x000008 295 image width
0x00000a 146 image height
0x00000c 150
0x00000d 80
0x00000e 1
0x000010 1537
or
0x000010 1
0x000011 6
0x000012 86
0x000014 - 0x000109 table
0x000110 295 image width (this should change when tga is saved)
0x000112 146 image height (this should change when tga is saved)

you need to fill in the blanks, best way is trial and error. :grin:

User avatar
Axis
Lieutenant-Commander
Lieutenant-Commander
Posts: 145
Joined: Sun Aug 16, 2015 8:28 am

Re: Race Fonts (*.fnt files)

Post by Axis » Wed Feb 10, 2016 12:41 am

OK.

I came to a conclusion that I'll use the original boxes and modify the fonzies based on them.

This is what I'd call 99% complete tech management screen (just "spit and polish", or sharpening of pixels) :
Techscreen 1920 x 1080.jpg
Techscreen 1920 x 1080.jpg (594.8 KiB) Viewed 4179 times
Here you can see, I used *20.fnt as *15, then largened *20 as new *20, then made *28 higher.
Btw, if anyone wants to do the same, one must keep in mind, always leave one row of pixels black at the bottom of the fontboxes
(otherwise the game cuts the letters off by one pixelrow, heightening textboxes in .wdfs won't help).

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6137
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: Race Fonts (*.fnt files)

Post by thunderchero » Thu Mar 17, 2016 10:17 am

well it is possible to create new fnt files.

at least the 9 fnt, I did not make much of a change 9 to 12 for larger gui's it uses larger tga file and each text area is larger with edited original header.
note; file still use *9.tga so no trek changes

here is header info I came up with

0x000 height of font +1
0x001 1 (all others) or 0 (9 fnt)
0x002 - 0x003 260 start of tga file
0x004 - 0x005 10 (unknow/unchanged)
0x006 - 0x007 120 total blocks
0x008 - 0x009 width of tga
0x00a - 0x00b height of tga
0x00c - 0x00F 47354 tga sile size in bytes
0x010 - 0x011 1536 (unknow/unchanged)
0x012 - 0x013 86 (unknow/unchanged)
0x014 - 0x103 placement

here is what changes looks like
before.jpg
before.jpg (497.17 KiB) Viewed 4070 times
after.jpg
after.jpg (500.09 KiB) Viewed 4070 times

Post Reply

Return to “Race Fonts (*.fnt files)”

Who is online

Users browsing this forum: No registered users