its possible to add new character to it?
original dds like this
this is example font
Code: Select all
//------------------------------------------------
//--- 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<chunk2.pages;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]<optimize=false>;
}chunk4;
if (FTell()<FileSize())
{
struct{
byte chunkID;//5
int chunkDataSize;
struct{
wstring charEncode1;//first
wstring charEncode2;//second
short amount;//kerning
}kernings[chunkDataSize/10];
}chunk5;
}
Allen wrote:If you know programming or are familiar with 010 hex editor data type, this binary template format will help you.Code: Select all
//------------------------------------------------
//--- 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]<optimize=false>;
}chunk4;
struct{
byte chunkID;//5
int chunkDataSize;
struct{
wstring charEncode1;
wstring charEncode2;
short distance_offset;//Character spacing, pixels
}table[chunkDataSize/10];
}chunk5;
Allen wrote:If you know programming or are familiar with 010 hex editor data type, this binary template format will help you.Code: Select all
//------------------------------------------------
//--- 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]<optimize=false>;
}chunk4;
struct{
byte chunkID;//5
int chunkDataSize;
struct{
wstring charEncode1;
wstring charEncode2;
short distance_offset;//Character spacing, pixels
}table[chunkDataSize/10];
}chunk5;
saeid0034 wrote:in sime fnt file your temple give me this error
Annotation 2020-04-13 153319.png
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.
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.
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.
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)
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
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