PDA

View Full Version : [TEC] HOW TO MAKE NEW FONT IN SH GAME?


Bartholomew Roberts
07-22-23, 06:53 AM
I want to make larger font for 4k UI.

I've looking into Data/Menu/Font/, ervery font contains 2 files. a tga or dds file, a off file , and some contains a txt file which has no use just to show the position of each letter.

I opened off file with HxD know it's a 16bit file. it clearly reflects the position table writes in txt file and you can not change dds into tga format or it ctd. So Anyone knows how to make this off file with what tool?:06:

KaleunMarco
07-22-23, 11:30 AM
I want to make larger font for 4k UI.

I've looking into Data/Menu/Font/, ervery font contains 2 files. a tga or dds file, a off file , and some contains a txt file which has no use just to show the position of each letter.

I opened off file with HxD know it's a 16bit file. it clearly reflects the position table writes in txt file and you can not change dds into tga format or it ctd. So Anyone knows how to make this off file with what tool?:06:

i use GIMP to edit TGA and DDS files.

Jeff-Groves
07-22-23, 12:47 PM
S3D is the tool needed.
Somewhere there is a post about doing the Fonts.

propbeanie
07-22-23, 01:09 PM
I want to make larger font for 4k UI.

I've looking into Data/Menu/Font/, ervery font contains 2 files. a tga or dds file, a off file , and some contains a txt file which has no use just to show the position of each letter.

I opened off file with HxD know it's a 16bit file. it clearly reflects the position table writes in txt file and you can not change dds into tga format or it ctd. So Anyone knows how to make this off file with what tool?:06:
S3D is the tool needed.
Somewhere there is a post about doing the Fonts.
That is correct sir! - How to create new game fonts (https://www.subsim.com/radioroom/showthread.php?p=956178#post956178)

Silent 3ditor download (https://www.subsim.com/radioroom/downloads.php?do=file&id=4489)

Both from skwasjer! :salute:

Jeff-Groves
07-22-23, 01:22 PM
That would be the thread I was talking about.
Be aware there may be issues like a black screen that don't show the fonts.
There are threads about that also if you search.

Bartholomew Roberts
07-22-23, 10:07 PM
S3D is the tool needed.
Somewhere there is a post about doing the Fonts.
Oh, I don't know S3D is that useful! Enlarge image is a easy job anyway, sadly I use excel to fast mutiply dimension array, now I have to do it manually:Kaleun_Salute:

Jeff-Groves
07-23-23, 01:35 PM
If you know the enlargement size of the texture file? Should be an easy calculation with a spread sheet.
:hmmm:

Bartholomew Roberts
07-23-23, 10:39 PM
If you know the enlargement size of the texture file? Should be an easy calculation with a spread sheet.
:hmmm:

But S3D cannot import txt or xls, I have to input every number one at a time:k_confused:

Jeff-Groves
07-24-23, 10:17 AM
The .off file is a simple format. One could write a converter to change a txt file fairly easily.

I probably have a script for 010 that could be modified to do that.
It converts an obj file (Which is just a txt file) to the SH5 RAW file format.

EDIT:
Found the Script. Should be easy to adjust it but it only runs in 010 Hex Editor.

Bartholomew Roberts
07-24-23, 11:32 AM
The .off file is a simple format. One could write a converter to change a txt file fairly easily.

I probably have a script for 010 that could be modified to do that.
It converts an obj file (Which is just a txt file) to the SH5 RAW file format.

EDIT:
Found the Script. Should be easy to adjust it but it only runs in 010 Hex Editor.

Another problem remains that most font in the game dont have a txt. convert into xls first is needed. and language code is a problem too, I think it is in Romanian but excel could not fully recognize all the letters.

Jeff-Groves
07-24-23, 12:30 PM
One could convert the .off to a text file also.
The characters are Ascii or Extended Ascii so wouldn't be that hard.
I'd think Excel would be able to handle extended Ascii.
:hmmm:

ä In the .off files translates to 228 which Exel should recognize.
So appears they used Unicode - Latin Supplement A
Can you send me a txt file that excel does not work with?

Looking at the txt files in Notepad shows they are a mess. 010 opens them really good!
So the import to Open Office always gives me fits!

Bartholomew Roberts
07-24-23, 02:15 PM
One could convert the .off to a text file also.
The characters are Ascii or Extended Ascii so wouldn't be that hard.
I'd think Excel would be able to handle extended Ascii.
:hmmm:

ä In the .off files translates to 228 which Exel should recognize.
So appears they used Unicode - Latin Supplement A
Can you send me a txt file that excel does not work with?

Looking at the txt files in Notepad shows they are a mess. 010 opens them really good!
So the import to Open Office always gives me fits!

It's in the Silent Hunter 4 Wolves of the Pacific Gold Edition\Data\Menu\Fonts
they're stock files like Agency_28.txt ,Chalk.txt, I use microsoft excel and libre office, can't find a suitable code match the 16bit display anyway

Jeff-Groves
07-24-23, 02:52 PM
In Open Office? I import with Tabs as the seperator
Then select Western Europe (Windows-1252/WinLatin 1)

Looks just like the txt file.

Having figured all that out? I can write a script to convert the .off to a text file.

Bartholomew Roberts
07-24-23, 08:37 PM
In Open Office? I import with Tabs as the seperator
Then select Western Europe (Windows-1252/WinLatin 1)

Looks just like the txt file.

Having figured all that out? I can write a script to convert the .off to a text file.

Yes, it shows correctly with (Windows-1252/WinLatin 1) but they are different letters from font to font. Take Agency_28 and chalk for example. With same format chalk can't be read correctly.

Agency_28 dds
https://img1.imgtp.com/2023/07/25/LQU5BdHw.jpg

Chalk
https://img1.imgtp.com/2023/07/25/tLVLrRgE.jpg

the libre office can't read chalk txt correctly alone with excel

https://img1.imgtp.com/2023/07/25/Mk1W9fe9.jpg

for microsoft excel opens in 1252, another ghost story

https://img1.imgtp.com/2023/07/25/icsJ7vdW.jpg

So it still has some trouble.

Bartholomew Roberts
07-24-23, 09:29 PM
https://img1.imgtp.com/2023/07/25/JgbLM864.jpg

Open office looks the same as libre office , " 226 113 10 32 the first letter caused the trouble, it only shows correctly in Notepad++

Jeff-Groves
07-25-23, 09:01 AM
In Open Office...............

There is a Text delimiter on import.
DELETE the " or ' you find there.
Leave it BLANK!!!
The file will show correct then. For the most part anyway.
There's still a few symbols that do not appear properly in a Spread sheet.
:hmmm:

I'm not a Spread Sheet expert nor use them myself.
Seeing as one does not need to change those symbols but only the sizes?
I'd code to adjust the sizes and leave the symbols alone.

Bartholomew Roberts
07-25-23, 10:41 AM
In Open Office...............

There is a Text delimiter on import.
DELETE the " or ' you find there.
Leave it BLANK!!!
The file will show correct then. For the most part anyway.
There's still a few symbols that do not appear properly in a Spread sheet.
:hmmm:

I'm not a Spread Sheet expert nor use them myself.
Seeing as one does not need to change those symbols but only the sizes?
I'd code to adjust the sizes and leave the symbols alone.

Oh, I didn't notice that , that also works for libre office. Years passed I almost forgot how to use spreadsheet. You need to do script both reading and writing off file, good luck.:Kaleun_Salute:

Jeff-Groves
07-25-23, 10:50 AM
I've already started the scripts but they only work with Sweetscape 010
https://sweetscape.com/

:up:

Kind of strange the Devs used different symbols in the off files as you probably never see most of them.
:hmmm:

Jeff-Groves
07-25-23, 11:48 AM
Looking at 'Some' wide screen mods?
They seemed to rename an off file to kind of fit then just scaled up the graphic file. So most of the symbols in some files are worthless.
:hmmm:

Bartholomew Roberts
07-25-23, 12:26 PM
I've already started the scripts but they only work with Sweetscape 010
https://sweetscape.com/

:up:

Kind of strange the Devs used different symbols in the off files as you probably never see most of them.
:hmmm:

I know the studio was in Romania that's why they use this code. There is no font for 4k in other mod, you simply need to double the font size. So no off file matches

Jeff-Groves
07-25-23, 12:38 PM
X, Y, Width, and Height only need to be scaled as long as they match the scale of the TGA or DDS file.
So if you scale say Chalk.dds up to 200%?
A script that scales the off file up should work. No need to translate off to text file.

Bartholomew Roberts
07-25-23, 09:25 PM
X, Y, Width, and Height only need to be scaled as long as they match the scale of the TGA or DDS file.
So if you scale say Chalk.dds up to 200%?
A script that scales the off file up should work. No need to translate off to text file.

but most Font in the game don't have a txt file, only off . So it's still needed. Say FPHunt38 eg. I wonder is there a way to transfer normal Font file like TTF、EOT into off. That would bring much more possiblities .

propbeanie
07-26-23, 07:08 AM
Just remember that the way the fonts were built for SH4 was an attempt to save on the RAM footprint (2005 programming). Some fonts do not have certain characters due to their use in the game that do not require all of the characters for varying applications. This is similar to indexed color use in tga or dds files. You choose the palette you work with.

Bartholomew Roberts
07-26-23, 07:32 AM
Just remember that the way the fonts were built for SH4 was an attempt to save on the RAM footprint (2005 programming). Some fonts do not have certain characters due to their use in the game that do not require all of the characters for varying applications. This is similar to indexed color use in tga or dds files. You choose the palette you work with.

Just in case someone play or make mod other than english, a unified code and little extra letters are need for all good. So I decided to enlarge some of the stock font for most compatibility.

Jeff-Groves
07-26-23, 01:32 PM
The fonts in Game only use the dds or tga file to render.
The off file only tells the Game the positions to read for each letter/symbol to render.
The txt file is only for checking out what the off file says to the Game.

As long as the new dds or tga follows how the originals are done?
Should be no problems as long as the off file is done correctly.
It's all explained in the linked thread somewhere above.

As for off files that have no txt that goes with them? I'll just translate those and provide a link to DownLoad.
I highly doubt anyone will use a script for 010 anyways.
:roll:

Jeff-Groves
07-28-23, 01:07 PM
Almost done with the script to translate the off files to text files.
Just need to format the output to look like the text files that already exist.
:)

https://www.subsim.com/radioroom/picture.php?albumid=1069&pictureid=13249

The reason I'm copying the original format is the translate txt to off file script will read the needed areas properly.

Jeff-Groves
07-28-23, 02:47 PM
I can tell you that some text files do NOT show all the settings in the off files.
So may need to re-export all the text files.

Format on export is done. Just need to convert the byte to a string character and then is all good.

A glimpe at the script..........

string f;
int k=3, i, c[3], y, x, h, w, sIndex;
ubyte l;
char W[40], sFile[];
//Start the code
OutputPaneClear();
sFile = InputOpenFileName("Select File", ("*.off | *.txt"));
sIndex = FileOpen(sFile);

f = FileNameGetBase(sFile, false) + ".off";
Printf("%s \n", f);//test for file name
Printf("Nb.char HSep VSep \n");
for( i = 0; i < k; i++)
{
c[i] = ReadInt();
FSkip(4);
}
Printf( " %i %i %i \n", c[0], c[1], c[2]);
Printf("Char x y width height \n");
for( i = 0; i < c[0]; i++)

{
l = ReadUByte();

Bartholomew Roberts
07-28-23, 08:58 PM
I can tell you that some text files do NOT show all the settings in the off files.
So may need to re-export all the text files.

Format on export is done. Just need to convert the byte to a string character and then is all good.

A glimpe at the script..........

string f;
int k=3, i, c[3], y, x, h, w, sIndex;
ubyte l;
char W[40], sFile[];
//Start the code
OutputPaneClear();
sFile = InputOpenFileName("Select File", ("*.off | *.txt"));
sIndex = FileOpen(sFile);

f = FileNameGetBase(sFile, false) + ".off";
Printf("%s \n", f);//test for file name
Printf("Nb.char HSep VSep \n");
for( i = 0; i < k; i++)
{
c[i] = ReadInt();
FSkip(4);
}
Printf( " %i %i %i \n", c[0], c[1], c[2]);
Printf("Char x y width height \n");
for( i = 0; i < c[0]; i++)

{
l = ReadUByte();

Shouldn't there be tab between letters&numbers?And is there a way to insert a equipment or upgrade and batch rename the item number behind?

Jeff-Groves
07-29-23, 10:06 AM
Everything IS Tab seperated.
Only difference to the output text is it uses DOS linefeed instead of the UNIX linefeed like the existing text files.

Imports to Spread Sheets just like the originals.
:03:


And is there a way to insert a equipment or upgrade and batch rename the item number behind?

I have no idea what you mean.
:hmmm:

Bartholomew Roberts
07-29-23, 01:51 PM
Everything IS Tab seperated.
Only difference to the output text is it uses DOS linefeed instead of the UNIX linefeed like the existing text files.

Imports to Spread Sheets just like the originals.
:03:


And is there a way to insert a equipment or upgrade and batch rename the item number behind?

I have no idea what you mean.
:hmmm:

Say you insert [Equipment 3] after [Equipment 2], then there are two [Equipment 3], if you want to make all equipments in group order, you have to add 1 number to every equipment behind. If you add more than one equipment in multiple places, it will be a mess. Is there a tool like S3D to handle this?

Jeff-Groves
07-29-23, 02:23 PM
We are talking about FONTS in this thread.
There is no Equipment to talk about.

Now if you mean adding characters? Yes. Once I do a reverse Script it will encode to the off format.
After that it's up to you to check and adjust as needed.

Jeff-Groves
08-01-23, 11:51 AM
Working with the Devs of 010 We found a Bug.
Some characters don't print out. They are going to fix that Bug.
In the mean time I use NotePad++ to insert the missing characters.

Since there's only around 16 off files that need a txt file it's not a big deal.
Once I have all the text files done I'll post a link to down load them all.
:up:

Bartholomew Roberts
08-02-23, 12:12 AM
Working with the Devs of 010 We found a Bug.
Some characters don't print out. They are going to fix that Bug.
In the mean time I use NotePad++ to insert the missing characters.

Since there's only around 16 off files that need a txt file it's not a big deal.
Once I have all the text files done I'll post a link to down load them all.
:up:

Good job, that could be used by all mod maker in the future. Only the large font need to be converted. For small font stock could be used, Agency_12 could be replaced by Agency_24. So you could do some 4 times off file just in case. Like Hunt152, FPArhi96, FPCond72 or Agency_112.

Jeff-Groves
08-02-23, 12:55 PM
Those Fonts don't exist so can not create a txt file.

Bartholomew Roberts
08-02-23, 10:00 PM
Those Fonts don't exist so can not create a txt file.

Just using the already enlarged txt and multiply their number by 2 again and rename accordingly. It is the OFF file that bother the most.

Jeff-Groves
08-03-23, 12:07 PM
It took 4 lines of code to double the settings in the off file.
Not only does the Script change the original off file?
It outputs a text file also.
Would you like to see one?
:03:

Not only can the Script double sizes. It can change sizes by addition.
Say you want a font only 2 pixels larger. So from 3 pixels to 5.
It can do that also.
:up:

Here's your FPHunt152.0ff
https://www.mediafire.com/file/w0hyyvmnxytovro/FPHunt152.off/file

Bartholomew Roberts
08-04-23, 01:40 PM
It took 4 lines of code to double the settings in the off file.
Not only does the Script change the original off file?
It outputs a text file also.
Would you like to see one?
:03:

Not only can the Script double sizes. It can change sizes by addition.
Say you want a font only 2 pixels larger. So from 3 pixels to 5.
It can do that also.
:up:

Here's your FPHunt152.0ff
https://www.mediafire.com/file/w0hyyvmnxytovro/FPHunt152.off/file

But that won't fit the image file,the whole point is to use existed image file to make exact font larger. All numbers must be mutiplied uniformly. If you want to make more variation, better to make small font 4x in dimension, like Agency_16 to Agency_64.

Jeff-Groves
08-04-23, 03:07 PM
You need to increase the dds or tga file.
It's not my intent to do the work for you!
Figure it all out.

Bartholomew Roberts
08-04-23, 10:17 PM
You need to increase the dds or tga file.
It's not my intent to do the work for you!
Figure it all out.

Sorry might be a misunderstanding there, I only mean there is no way to increase image size unevenly in math standard.

"Not only can the Script double sizes. It can change sizes by addition.
Say you want a font only 2 pixels larger. So from 3 pixels to 5.
It can do that also." That won't work.
As long as multiply the number of off with int, the image would fit, your FPHunt152.0ff would absolutely work in theory:Kaleun_Salute:

---------------------------------------
I'v checked your file, there seems a little trouble.
https://img1.imgtp.com/2023/08/05/Jrg8ywdz.jpg

FPHunt152 should be 4x the size of FPHunt38 right? But the actual size is smaller. I'v already enlarged the dds. That is our first test anyway.

This is how it should look

https://img1.imgtp.com/2023/08/05/6QC5kVDJ.jpg

Bartholomew Roberts
08-04-23, 11:31 PM
And I found another astonishing fact, different version has different basic font

https://img1.imgtp.com/2023/08/05/AFbY0Xa8.jpg

The smaller on is from KSDII mod that's russian font I guess

So make sure to use the stock Font of english version's off file

Jeff-Groves
08-05-23, 07:39 AM
The FPHunt152 is FPHunt15 doubled.
I can do FPHunt38 4X if you want.

Bartholomew Roberts
08-05-23, 10:22 AM
The FPHunt152 is FPHunt15 doubled.
I can do FPHunt38 4X if you want.

Ok, lets make the naming rule to be more clear, the number after Font(Name) is their zise number as the normal font. The double sized FPHunt15 is 30, smaller than the existed FPHunt 38, so no need to be doubled, Only final size over the existing Font need to be made, like either 38x2 or 15x4 is larger than the existing one. To make 4K UI, you need 2X of the largest stock font to match current display. But it might not be enough to the future need, so extra large font should be prepared in case.:Kaleun_Salute:

Jeff-Groves
08-05-23, 10:41 AM
Names will be like this
FPHunt15x2.off
FPHunt15x4.off
and so on for all fonts.

And I'll do all the Stock English off files just incase.

Should anyone want a Non-Stock Non-English off changed they will need to be uploaded so I can get them.

Jeff-Groves
08-05-23, 12:52 PM
How does one invert the alpha channel in PhotoShop?
Working on a new font but need to figure that out!
:hmmm:

Bartholomew Roberts
08-05-23, 01:07 PM
How does one invert the alpha channel in PhotoShop?
Working on a new font but need to figure that out!
:hmmm:

Click Alpha in channel pop up window, Ctrl+I

Jeff-Groves
08-06-23, 11:27 AM
Got the image done for a New Font.
Now looking for an older PC to run Win XP to put S3D on.
:doh: