Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

edit binary fnt/dds file

Featured Replies

  • Author
  • Localization

saeid0034, posted Sun Apr 12, 2020 9:37 am (55803)


Hi i want a way to edit l.a. noire font for add some new character to it
its possible to add new character to it?
original dds like this
Image

this is example font
  • Author
  • Localization

Allen, posted Mon Apr 13, 2020 8:11 am (55856)


If you know programming or are familiar with 010 hex editor data type, this binary template format will help you.

Code:
//------------------------------------------------
//--- 010 Editor v9.0.2 Binary Template
//
//      File: L.A. Noire .fnt
//   Authors: Allen
//   Version:
//   Purpose:
//  Category:
// File Mask:
//  ID Bytes:
//   History:
//------------------------------------------------
char    BFM3[4];//BFM\x3

struct{
    byte    chunkID;//1
    int     chunkDataSize;
    short   u1;//size?
    short   u2;//?
    short   stretchH;
    byte    smooth;
    byte    padding[4];
    byte    spacing[2];
    byte    outline;
    string  fontName;
}chunk1;

struct{
    byte    chunkID;//2
    int     chunkDataSize;
    short   lineHeight;
    short   base;
    short   imageWidth;//dds file is 32bpp rgba8888 format
    short   imageHeight;
    byte    pages;
    short   packed;
    byte    alphaChnl;
    byte    redChnl;
    byte    greenChnl;
    byte    buleChnl;
}chunk2;
local int i;
struct{
    byte    chunkID;//3
    int     chunkDataSize;
    for (i=0;i    {
        struct{
        string  fontImageName;
        }imageName;
    }

}chunk3;
struct{
    byte    chunkID;//4
    int     chunkDataSize;
    struct{
        int   charEncode;//unicode
        short x1;
        short y1;
        short width;
        short height;
        short xoffset;
        short yoffset;
        short xadvance;
        byte  page;
        byte  chnl;
    }index[chunkDataSize/20];
}chunk4;
if (FTell(){
struct{
    byte    chunkID;//5
    int     chunkDataSize;
    struct{
        wstring charEncode1;//first
        wstring charEncode2;//second
        short amount;//kerning
    }kernings[chunkDataSize/10];
}chunk5;
}
  • Author
  • Localization

saeid0034, posted Mon Apr 13, 2020 10:28 am (55861)


Allen wrote:
If you know programming or are familiar with 010 hex editor data type, this binary template format will help you.

Code:
//------------------------------------------------
//--- 010 Editor v9.0.2 Binary Template
//
//      File: L.A. Noire .fnt
//   Authors: Allen
//------------------------------------------------
char    BFM3[4];//BFM\x3

struct{
    byte    chunkID;//1
    int     chunkDataSize;
    short   u1;
    short   u2;
    short   u3;
    byte    u4[8];
    string  unkStr;
}chunk1;

struct{
    byte    chunkID;//2
    int     chunkDataSize;
    short   u1;
    short   u2;
    short   imageWidth;//dds file is 32bpp rgba8888 format
    short   imageHeight;
    byte    u3;
    byte    u4[2];
    int     u5;
}chunk2;
struct{
    byte    chunkID;//3
    int     chunkDataSize;
    string  fontImageName;
}chunk3;
struct{
    byte    chunkID;//4
    int     chunkDataSize;
    struct{
        int   charEncode;//unicode
        short x1;
        short y1;
        short width;//base rectangle
        short height;//base rectangle
        short xoffset;// is left offset, - is right offset
        short yoffset;// is up offset, - is down offset
        short showWidth;
        short unk;//0xf00
    }index[chunkDataSize/20];
}chunk4;

struct{
    byte    chunkID;//5
    int     chunkDataSize;
    struct{
        wstring charEncode1;
        wstring charEncode2;
        short distance_offset;//Character spacing, pixels
    }table[chunkDataSize/10];
}chunk5;

tnx im not very familler with hex editing
but i will cheak
  • Author
  • Localization

saeid0034, posted Mon Apr 13, 2020 10:36 am (55862)


im want to add some value to original fnt
its possible with your template?
  • Author
  • Localization

saeid0034, posted Mon Apr 13, 2020 11:04 am (55863)


Allen wrote:
If you know programming or are familiar with 010 hex editor data type, this binary template format will help you.

Code:
//------------------------------------------------
//--- 010 Editor v9.0.2 Binary Template
//
//      File: L.A. Noire .fnt
//   Authors: Allen
//------------------------------------------------
char    BFM3[4];//BFM\x3

struct{
    byte    chunkID;//1
    int     chunkDataSize;
    short   u1;
    short   u2;
    short   u3;
    byte    u4[8];
    string  unkStr;
}chunk1;

struct{
    byte    chunkID;//2
    int     chunkDataSize;
    short   u1;
    short   u2;
    short   imageWidth;//dds file is 32bpp rgba8888 format
    short   imageHeight;
    byte    u3;
    byte    u4[2];
    int     u5;
}chunk2;
struct{
    byte    chunkID;//3
    int     chunkDataSize;
    string  fontImageName;
}chunk3;
struct{
    byte    chunkID;//4
    int     chunkDataSize;
    struct{
        int   charEncode;//unicode
        short x1;
        short y1;
        short width;//base rectangle
        short height;//base rectangle
        short xoffset;// is left offset, - is right offset
        short yoffset;// is up offset, - is down offset
        short showWidth;
        short unk;//0xf00
    }index[chunkDataSize/20];
}chunk4;

struct{
    byte    chunkID;//5
    int     chunkDataSize;
    struct{
        wstring charEncode1;
        wstring charEncode2;
        short distance_offset;//Character spacing, pixels
    }table[chunkDataSize/10];
}chunk5;

in sime fnt file your temple give me this error
  • Author
  • Localization

Allen, posted Mon Apr 13, 2020 1:51 pm (55867)


saeid0034 wrote:
in sime fnt file your temple give me this error
Annotation 2020-04-13 153319.png

Your file is only 1620 bytes, of course, it will be wrong, it is not complete, it is offset at 0x59, and the data size of chunk4 is 0x3c8c (15500). So this is not a template error, it is yours.

Here is an example, I only added 2 characters manually: ??.

fnt part:
chunk4 is a character information table.
at offset 0x59:
change chunkDataSize 8680 to 8720.
Because the one-letter information table occupies 20 bytes.

at offset 0x2245:(the chunk4 end offset)
insert 40 bytes.
re-run binary template.
In the template, go to the end of CHUNK4 and find the newly added 2 pieces of data. You will find that all are 0. We enter the relevant data in the template.


You will find that it has been added correctly.

dds part:

Use the reference line function of PS to obtain the relevant coordinate data and input it into the fnt file. Save the new DDS font.
Note**: save 32bpp format.

char part:
Save the character you want to add as UNICODE text, and then open it with a hex editor, excluding the BOM header 2 bytes, the remaining bytes every 2 bytes is an encoding.
  • Author
  • Localization

saeid0034, posted Mon Apr 13, 2020 10:01 pm (55877)


Allen wrote:
saeid0034 wrote:
in sime fnt file your temple give me this error
Annotation 2020-04-13 153319.png

Your file is only 1620 bytes, of course, it will be wrong, it is not complete, it is offset at 0x59, and the data size of chunk4 is 0x3c8c (15500). So this is not a template error, it is yours.

Here is an example, I only added 2 characters manually: ??.

fnt part:
chunk4 is a character information table.
at offset 0x59:
change chunkDataSize 8680 to 8720.
Because the one-letter information table occupies 20 bytes.

at offset 0x2245:(the chunk4 end offset)
insert 40 bytes.
re-run binary template.
In the template, go to the end of CHUNK4 and find the newly added 2 pieces of data. You will find that all are 0. We enter the relevant data in the template.


You will find that it has been added correctly.

dds part:

Use the reference line function of PS to obtain the relevant coordinate data and input it into the fnt file. Save the new DDS font.
Note**: save 32bpp format.

char part:
Save the character you want to add as UNICODE text, and then open it with a hex editor, excluding the BOM header 2 bytes, the remaining bytes every 2 bytes is an encoding.

tnx for this good guide
only one more Question
I need to increase the size of the dds file to 1024x1024 to add all my character to it
after that i need to edit all char location again then after that add my char to fnt?
  • Author
  • Localization

Allen, posted Tue Apr 14, 2020 1:04 am (55887)


If you expand the picture, if the original characters are still in the original position, then you do not need to change all the characters, only need to care about your newly added characters.
Because the coordinate value is an absolute value, no matter how you extend it, it will not be disturbed.

In CHUNK2 you need to modify the corresponding width and height information.
  • Author
  • Localization

saeid0034, posted Tue Apr 14, 2020 9:03 am (55898)


Allen wrote:
If you expand the picture, if the original characters are still in the original position, then you do not need to change all the characters, only need to care about your newly added characters.
Because the coordinate value is an absolute value, no matter how you extend it, it will not be disturbed.

In CHUNK2 you need to modify the corresponding width and height information.

tnx man
you really saved me
  • Author
  • Localization

saeid0034, posted Tue Apr 14, 2020 9:13 pm (55945)


Allen wrote:
If you expand the picture, if the original characters are still in the original position, then you do not need to change all the characters, only need to care about your newly added characters.
Because the coordinate value is an absolute value, no matter how you extend it, it will not be disturbed.

In CHUNK2 you need to modify the corresponding width and height information.

Is there no way to automate the process of changing values?
i need to change values in 10 file, And doing all this manually takes a long time (very long)
I tried to do it manually
After an hour and a half, only 100 of the 433 completed (in one file)
  • Author
  • Localization

Allen, posted Wed Apr 15, 2020 3:51 am (55953)


saeid0034 wrote:
Is there no way to automate the process of changing values?
i need to change values in 10 file, And doing all this manually takes a long time (very long)
I tried to do it manually
After an hour and a half, only 100 of the 433 completed (in one file)

I will write a tool for you. Yesterday I received your private message. You said that your new font was generated by BMFONT. I read the binary FNT format generated by BMFONT today. It turned out to be the same format as the game using fnt. That is to say, the format of the game is BMFONT. However, there are a lot of custom icons, so all we have to do is add new characters, not create new ones.

I will upload a tool later to add a new fnt index to the game's existing fnt file.
Don't forget the alpha channel when merging pictures, because the alpha channel determines which part of the character is displayed.

I will only support fnt binary files generated by BMFont v1.14beta64 version.
BMfont 64bit executable for v1.14 beta (1.65MB, 2019/11/15)
http://www.angelcode.com/products/bmfont/bmfont64.exe
v1.13 Can't run on my computer.

I have updated the format template.
viewtopic.php?f=7&t=13442#p55856
  • Author
  • Localization

saeid0034, posted Wed Apr 15, 2020 9:20 am (55956)


Allen wrote:
saeid0034 wrote:
Is there no way to automate the process of changing values?
i need to change values in 10 file, And doing all this manually takes a long time (very long)
I tried to do it manually
After an hour and a half, only 100 of the 433 completed (in one file)

I will write a tool for you. Yesterday I received your private message. You said that your new font was generated by BMFONT. I read the binary FNT format generated by BMFONT today. It turned out to be the same format as the game using fnt. That is to say, the format of the game is BMFONT. However, there are a lot of custom icons, so all we have to do is add new characters, not create new ones.

I will upload a tool later to add a new fnt index to the game's existing fnt file.
Don't forget the alpha channel when merging pictures, because the alpha channel determines which part of the character is displayed.

I will only support fnt binary files generated by BMFont v1.14beta64 version.
BMfont 64bit executable for v1.14 beta (1.65MB, 2019/11/15)
http://www.angelcode.com/products/bmfont/bmfont64.exe
v1.13 Can't run on my computer.

I have updated the format template.
viewtopic.php?f=7&t=13442#p55856

Thank you very much
it seems that the only hard part is editing font that also contains icons ...
Other fonts can be Built directly with bmfont
  • Author
  • Localization

Allen, posted Wed Apr 15, 2020 2:56 pm (55962)


This is a tool you can test, all values are generated based on BMFONT, except for the y value and the image height value, the other has not been modified. I just merge FNT files.

FntTool.zip

  • Author
  • Localization

saeid0034, posted Wed Apr 15, 2020 4:32 pm (55965)


Allen wrote:
This is a tool you can test, all values are generated based on BMFONT, except for the y value and the image height value, the other has not been modified. I just merge FNT files.
FntTool.zip

Thank you very much
Do I have to manually change these two values (y and height)? (add 512 to to all old cahr -y- value)
----edit----
i read your tool help, and now i understand everything
tnx man
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.