bft font image

Get your graphics formats figures out here! Got details for others? Post here!
adol365
advanced
Posts: 70
Joined: Fri Nov 21, 2014 12:21 pm
Has thanked: 17 times
Been thanked: 7 times

bft font image

Post by adol365 » Wed Nov 02, 2016 5:29 pm

It contains font table and graphic data, however I don't have an idea how to get texture. Does any one can look at it?

Samples https://www.sendspace.com/file/4rsl7e

herbert3000
veteran
Posts: 134
Joined: Wed Jun 02, 2010 4:53 am
Has thanked: 18 times
Been thanked: 143 times
Contact:

Re: bft font image

Post by herbert3000 » Fri Nov 04, 2016 11:08 am

Here's what I found out about the file format:

Code: Select all

// main_font_sdw_vita.unpack

byte header[12]; // it's the same in both .unpack files

int characterCount;

struct charInfo {
  short keycode;
  byte zero; // always zero
  byte xOffset; // not sure about the offsets
  byte yOffset;
  byte horOffset;
  byte charWidth;
  byte charHeight;
  int unknown; // initial value = 0x55800000, increases by 0x56 each line
};


// @0x1525C

struct charData {
  byte charBitmap[19 * 36];
  int unknown; // alwys zero? padding?
};


// @0x4D160C
// don't know what that section is

int unknownCount;

struct unknown {
  short;
  short;
  int;
};

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 3461
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 955 times
Been thanked: 1876 times

Re: bft font image

Post by shakotay2 » Fri Nov 04, 2016 6:55 pm

texturefinder reveals more about main_font.unpack:
main_font-unpack.JPG
You do not have the required permissions to view the files attached to this post.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

herbert3000
veteran
Posts: 134
Joined: Wed Jun 02, 2010 4:53 am
Has thanked: 18 times
Been thanked: 143 times
Contact:

Re: bft font image

Post by herbert3000 » Fri Nov 04, 2016 8:06 pm

The font characters are simple 8-bit grayscale bitmaps with a fixed size of 19x36 pixels per character.
Here's a screenshot of the characters in main_font.unpack, mapped onto a 1024 pixels wide texture atlas:
screenshot.png
You do not have the required permissions to view the files attached to this post.

adol365
advanced
Posts: 70
Joined: Fri Nov 21, 2014 12:21 pm
Has thanked: 17 times
Been thanked: 7 times

Re: bft font image

Post by adol365 » Sat Nov 05, 2016 1:25 am

herbert3000 wrote:The font characters are simple 8-bit grayscale bitmaps with a fixed size of 19x36 pixels per character.
Here's a screenshot of the characters in main_font.unpack, mapped onto a 1024 pixels wide texture atlas:
screenshot.png
Oh, did you open it as a raw file from Photoshop? Is there a specific height?

herbert3000
veteran
Posts: 134
Joined: Wed Jun 02, 2010 4:53 am
Has thanked: 18 times
Been thanked: 143 times
Contact:

Re: bft font image

Post by herbert3000 » Sat Nov 05, 2016 4:35 pm

adol365 wrote:Oh, did you open it as a raw file from Photoshop? Is there a specific height?
Actually I wrote a simple java program that converts the font file into a raw image.
fontToRaw.zip
You do not have the required permissions to view the files attached to this post.

adol365
advanced
Posts: 70
Joined: Fri Nov 21, 2014 12:21 pm
Has thanked: 17 times
Been thanked: 7 times

Re: bft font image

Post by adol365 » Sun Nov 06, 2016 3:14 am

herbert3000 wrote:
adol365 wrote:Oh, did you open it as a raw file from Photoshop? Is there a specific height?
Actually I wrote a simple java program that converts the font file into a raw image.
fontToRaw.zip
Uhm.. unfortunately I had never learned Java. :(

User avatar
Acewell
VIP member
VIP member
Posts: 1329
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2683 times
Been thanked: 841 times

Re: bft font image

Post by Acewell » Sun Nov 06, 2016 5:22 am

adol365 wrote:Uhm.. unfortunately I had never learned Java. :(
just drop your samples in the folder with the fontToRaw java files
open a command prompt there and type
java fontToRaw
press Enter then it'll ask for a file name like this
Enter filename:
then you can type the name of your sample file and press Enter
and you will get a raw image file of that sample in that folder
that you can open in Photoshop with the dimensions in the file name

:D

herbert3000
veteran
Posts: 134
Joined: Wed Jun 02, 2010 4:53 am
Has thanked: 18 times
Been thanked: 143 times
Contact:

Re: bft font image

Post by herbert3000 » Sun Nov 06, 2016 9:34 pm

@adol365: Just a quick question. At the current state the program outputs this data:
https://www.mediafire.com/?7acvohe2y3tcb79
Is this sufficient for you to edit the font? If yes, I could start to write the repacker.

adol365
advanced
Posts: 70
Joined: Fri Nov 21, 2014 12:21 pm
Has thanked: 17 times
Been thanked: 7 times

Re: bft font image

Post by adol365 » Mon Nov 07, 2016 1:33 am

herbert3000 wrote:@adol365: Just a quick question. At the current state the program outputs this data:
https://www.mediafire.com/?7acvohe2y3tcb79
Is this sufficient for you to edit the font? If yes, I could start to write the repacker.
Yes, it is sufficient for me. By the way, is horOffset means xadvance?

herbert3000
veteran
Posts: 134
Joined: Wed Jun 02, 2010 4:53 am
Has thanked: 18 times
Been thanked: 143 times
Contact:

Re: bft font image

Post by herbert3000 » Mon Nov 07, 2016 3:34 am

I pretty sure I mixed up the offsets (x/y/hor).
The value that is currently named horOffset is high for characters like "." and "," so I think that's the actual y-offset, is that possible?

adol365
advanced
Posts: 70
Joined: Fri Nov 21, 2014 12:21 pm
Has thanked: 17 times
Been thanked: 7 times

Re: bft font image

Post by adol365 » Mon Nov 07, 2016 6:30 am

herbert3000 wrote:I pretty sure I mixed up the offsets (x/y/hor).
The value that is currently named horOffset is high for characters like "." and "," so I think that's the actual y-offset, is that possible?
But isn't you already declare yoffset before horOffset?
I'm not sure exactly what horOffset means but it doesn't quiet matter if one can make a new font.

herbert3000
veteran
Posts: 134
Joined: Wed Jun 02, 2010 4:53 am
Has thanked: 18 times
Been thanked: 143 times
Contact:

Re: bft font image

Post by herbert3000 » Wed Nov 09, 2016 12:12 am

adol365 wrote:But isn't you already declare yoffset before horOffset?
I'm not sure exactly what horOffset means but it doesn't quiet matter if one can make a new font.
xOffset, yOffset and horOffset were my first guess for the last 3 values but I guess I was wrong :)
If you figure out the true meaning, I can correct that in the program.

But you are right, for making a new font, the names of the keywords are irrelevant.
I should have named them unknown1, unknown2 and unknown3 :P

adol365
advanced
Posts: 70
Joined: Fri Nov 21, 2014 12:21 pm
Has thanked: 17 times
Been thanked: 7 times

Re: bft font image

Post by adol365 » Wed Nov 09, 2016 3:19 am

herbert3000 wrote:
adol365 wrote:But isn't you already declare yoffset before horOffset?
I'm not sure exactly what horOffset means but it doesn't quiet matter if one can make a new font.
xOffset, yOffset and horOffset were my first guess for the last 3 values but I guess I was wrong :)
If you figure out the true meaning, I can correct that in the program.

But you are right, for making a new font, the names of the keywords are irrelevant.
I should have named them unknown1, unknown2 and unknown3 :P
In my opinion, the easy way to confirm what is the meaning of UNK1, 2, 3 is that modify fnt table data and take a test in the game. :)

herbert3000
veteran
Posts: 134
Joined: Wed Jun 02, 2010 4:53 am
Has thanked: 18 times
Been thanked: 143 times
Contact:

Re: bft font image

Post by herbert3000 » Mon Nov 14, 2016 8:34 am

Here's a converter for the file main_font.unpack:
FontTools.zip
Usage: Run the .bat file,
to unpack the file enter: main_font.unpack
to repack the file enter: main_font.unpack.txt

Backup your original files because this tool will overwrite existing files without confirmation.
You do not have the required permissions to view the files attached to this post.

Post Reply