Page 1 of 1

Python TTF to PNG converter (for custom FNT files)

Posted: Thu May 21, 2020 3:21 pm
by Poipt
Script: https://gist.github.com/Poipt/687aad39a ... 67ec324d13

I'm pretty sure that this hasn't already been created already but I could be wrong. I'm also not sure how to import custom cuts, so help with that would be appreciated. If I can do that I'll try and figure out a way to automatically detect cuts. Let me know if you have any problems or need clarification on something :)

EDIT: I figured it out so I'm going to try to work on that.

EDIT 2: The font size flag is broken, so don't use it until I update the Gist.

Re: Python TTF to PNG converter (for custom FNT files)

Posted: Thu May 21, 2020 8:04 pm
by Poipt
Alright, bugs are fixed and it can automatically create XML cut files.

Re: Python TTF to PNG converter (for custom FNT files)

Posted: Mon Jun 01, 2020 1:16 am
by ShrineFox
This is really rad, thanks so much for taking the time to make and post this! I can see it making the font modding process way more approachable.

Re: Python TTF to PNG converter (for custom FNT files)

Posted: Mon Jun 01, 2020 1:20 am
by Poipt
After about a day of learning C# image processing, I present to you the incredibly spaghetti coded GUI version of this tool

https://cdn.discordapp.com/attachments/ ... TF2PNG.exe

If you find any bugs or have any questions, let me know :)

btw the S slider is for font size

Re: Python TTF to PNG converter (for custom FNT files)

Posted: Tue Jun 16, 2020 8:05 pm
by Reishiki
Thank you for this! I tried with one of the font I had. After clicking Save, I got an image but it has all sort of characters like Greek, Cyrillic etc that doesn't included in the font file (and I don't need them, either). Also the actual Vietnamese characters I need that included in the font file are nowhere to be found in the PNG. Could you tell me how to fix that?
As I'm not quite sure how to use this program, is there a guide or anything that I should pay attention to when using the program?

Re: Python TTF to PNG converter (for custom FNT files)

Posted: Wed Jun 17, 2020 12:03 am
by Poipt
Ah, I was wondering about that. I'm not sure exactly what character sequence they use in the original game because it iterates through Japanese characters as well. All I really cared about was English, so it was fine with me. I'll work on it tomorrow. To use the program, click the load button and select the TTF file. After it finishes loading, you should be able to see the whitespace character on the right of the screen. You can use the sliders on the bottom and all the way to the right to scroll through different characters in the image. As for the options on the left the generate XML check box decides whether or not the program should generate the cut data used to get rid of unnecessary space on the sides of the characters. You should check that box before you load the TTF or click refresh, or else it will not generate. X changes the X offset of the characters, and Y changes the Y offset. S changes the font size. Once you change X, Y, or S, you can click refresh to see the updated version. Once you are done, you can press save and it will ask you where you want to save the PNG and XML (if you checked the box) files to. Hope that helps!