Hardware [RELEASE] NintyFont - Nintendo binary font editor

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
101
Trophies
0
Location
Houen Chihou
XP
1,408
Country
Russia
(Note: there doesn't seem to be a subforum for multi-console romhacking utilities, so I guess since it supports hacking Wii fonts, here it goes into the Wii subforum)

So, I've been working on an editor for various raster fonts found in Nintendo games since 2018, and here it is!

Supported formats:
- BRFNT (loading and saving)
- NFTR/RTFN (loading and saving, even supports NFTRs found in GameFreak's Pocket Monsters BW/B2W2 games)
- Pocket Monsters D/P/Pt/HG/SS fonts (loading and saving)
- BCFNT (loading and saving, needs testing though)
- JUTResFont/FONTbfn1 (only loading)
- BFTTF/BFOTF (decryption and encryption)

Other formats to be supported eventually:
- BFFNT (in progress, needs texture codecs for WiiU and Switch, as well as support for editing kerning data found in this format)

The program obviously needs more work, as in many ways it doesn't even reach feature parity with the original. Additionally I don't do much testing other than confirming that everything isn't completely broken, so bugs are very much present. If you have any suggestions on what to improve or bugs to report, feel free to file an issue on GitHub or post it here.

The project is written in C++ with Qt5 GUI and is open source under GNU GPL v3:
Source code: git repo (see details and build instructions there in the readme)
Builds (Windows and Linux, sorry macOS users, I don't even have a setup to test out building it): GitHub releases

This program is heavily based on BRFNTify-Next both in GUI design and GUI code, so a big credit goes to Tempus and RoadrunnerWMC for making it!

Screenshots of the program with different fonts open:
As someone from Russia, where we didn't see any official translations of Nintendo games back in the day (and even now it's not uncommon for Nintendo to release an unlocalized game here), so I've always been interested in translating said games...and the biggest roadblock has always been the fonts...argh, those goddamn fonts! So, because of that I never really progressed with any of my translations, knowing that I wouldn't be able to make it work in the end anyways (other than one single time, when I translated all the texts in Super Mario Galaxy 2...but that was before I found out that I couldn't properly edit the fonts...so that project just got trashed and now the files to it are lost forever other than a few ones I found on an old grandparents' PC I copied them to for testing at the time)... then I discovered BRFNTify-Next, which seemed like the solution to all my issues!.. except there was a problem - it couldn't save anything(well, now it can, but eh 6 years too late). I wasn't much good with programming back then, but it interested me enough to at least investigate. I began messing with it's source code around 2018, trying to make it save something (and being a dumb idiot, furthermore being more familiar with C-like languages(C# to be exact), I didn't understand Python very good) and I only ended up making a modified version of BRFNTify-Next that could output xlor files for use with the SDK font converter. At that point I decided to start work on my own utility, unoriginally named BXFNTify, using Windows Forms in C# but I wasn't moving all that fast with it, so I used pieces of the code I already wrote for BXFNTify and some code from the BRFNTify-Next mod to bodge together XLORify-Sharp(which is a steaming pile of garbage code). Despite that, I continued to work on BXFNTify throughout 2019, getting BRFNT to load and save correctly...but at the end of 2019 a change came in my life - I got fed up with MS Windows, furthermore I realized that WinForms were gonna restrict me in way which would require me to use native Windows APIs to implement stuff that I wanted...and on one day in December of 2019 I left Windows and switched to Linux Mint. I was somewhat familiar with it already, as I've used Ubuntu many times before, so it was (mostly) a smooth transition. At this point I decided to rewrite the program in C++ using Qt5 (just like BRFNTify-Next does, except it's written in Python)...and that's where I came up with this "original" new name for the program since I felt kinda bad stealing even the name of BRFNTify-Next. And from there on, I've been working on it from time to time, writing one thing, fixing another, and by the end of December 2020 I had already thought of releasing it, but spent a bit more time refactoring and cleaning up the code (I'm sure there are many obvious bugs I missed, as well as improperly formatted text)(and even managed to quickly implement a BCFNT loader in a few days before release lol), and here it is.
 
Last edited by CHEMI6DER,

Reishiki

Member
Newcomer
Joined
Jul 9, 2014
Messages
17
Trophies
0
Age
31
XP
209
Country
Thank you so much for this! I've been waiting for a tool that can edit BFFNT for switch, I'm looking forward to the new feature! ^^
 

tomx86

Well-Known Member
Member
Joined
Jun 3, 2015
Messages
729
Trophies
0
Age
35
XP
1,454
Country
Poland
Hey when I import .png image after editing it in Photoshop (adding new characters) the color of the font changes and it looks bad in the game, what am I doing wrong, please help.
 

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
101
Trophies
0
Location
Houen Chihou
XP
1,408
Country
Russia
Hey when I import .png image after editing it in Photoshop (adding new characters) the color of the font changes and it looks bad in the game, what am I doing wrong, please help.
Hi! Could you elaborate some more on what exactly you were trying to do? Any technical details would be nice, as it's hard to guess on the generic info you gave. Like, which font format you were trying to edit and which texture format it uses. This sounds like a texture encoder bug to me, but I could be wrong.
Also does the color get messed up only if you add character or does it happen even if you re-save the original file without edits?
 

tomx86

Well-Known Member
Member
Joined
Jun 3, 2015
Messages
729
Trophies
0
Age
35
XP
1,454
Country
Poland
Hi! Could you elaborate some more on what exactly you were trying to do? Any technical details would be nice, as it's hard to guess on the generic info you gave. Like, which font format you were trying to edit and which texture format it uses. This sounds like a texture encoder bug to me, but I could be wrong.
Also does the color get messed up only if you add character or does it happen even if you re-save the original file without edits?
Sorry I've download the wrong editor with a similar name to yours "BRFNTify-Next" and after I realized that I've added the new characters in your editor and everything is fine now, so great work on the editor, and I'm also can wait for the BFFNT support, and I hope you also add support for the 3DS version of the font:bow::bow::bow:
So, sorry again for the mix up and thank you for the editor:D
 
  • Like
Reactions: ChibiMofo

Campbelden

Member
Newcomer
Joined
Sep 30, 2021
Messages
5
Trophies
0
Age
26
XP
13
Country
United States
I've been waiting for a tool that can edit the BFFNT for the switch. I'm looking forward to the new feature! Any technical details would be lovely, as it's hard to guess at the general information you provided. For example, what font format you were trying to edit and what texture format it uses. I found a cool font at https://upfonts.com/peace-sans-font-toy-story-font/. I was immediately reminded of the movie Toy Story. I loved watching it as a kid. So I often use this font when I do some work for my studies.
 
Last edited by Campbelden,

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
101
Trophies
0
Location
Houen Chihou
XP
1,408
Country
Russia
Could you add a feature that converts brfnt to ttf so you can use the font of the game on your PC
No, that wouldn't be the case for two reasons:
1) It's not the purpose of this tool to do this kind of a thing, NintyFont is a font editor for (primarily) NintendoWare files;
2) Even if I wanted to, it's not possible to do this kind of convertion neatly anyways, since BxFNT are bitmap fonts (meaning they store glyphs as raster images, usually at a pretty low resolution) but TTF/OTF are vector fonts.

If you really want a TTF of a font you found in a game and it wasn't custom-made for it (so like, an off-the-shelf font...Nintendo likes to use FOT fonts for their stuff), I might suggest you to try to put it through some sort of online font recognition service (https://en.likefont.com is a good one, used it many times, works very well for basically anything since it's not limited to Latin) and then just search for the font file online (there are many resources where you can get them...just google the font name / file name, and you'll find it eventually).
 

GlitchingNo

Member
Newcomer
Joined
Mar 11, 2021
Messages
9
Trophies
0
Age
41
XP
55
Country
Germany
No, that wouldn't be the case for two reasons:
1) It's not the purpose of this tool to do this kind of a thing, NintyFont is a font editor for (primarily) NintendoWare files;
2) Even if I wanted to, it's not possible to do this kind of convertion neatly anyways, since BxFNT are bitmap fonts (meaning they store glyphs as raster images, usually at a pretty low resolution) but TTF/OTF are vector fonts.

If you really want a TTF of a font you found in a game and it wasn't custom-made for it (so like, an off-the-shelf font...Nintendo likes to use FOT fonts for their stuff), I might suggest you to try to put it through some sort of online font recognition service (https://en.likefont.com is a good one, used it many times, works very well for basically anything since it's not limited to Latin) and then just search for the font file online (there are many resources where you can get them...just google the font name / file name, and you'll find it eventually).
Oh ok thank you for your fast respond
 

Dionicio3

The Skiddo
Member
Joined
Feb 26, 2017
Messages
3,794
Trophies
2
Age
18
Location
Hollister, CA
Website
dionicio3.com
XP
4,539
Country
United States
Hi, I have an NFTR font that's in Shift-JIS format, but the program detects in as UTF-8. I also can't seem to change it to Shift-JIS ("Edit > Reencode" does nothing). I also cannot seem to get the preview window to appear. The fonts I'm testing are from Kanji Sonomama Rakubiki Jiten DS. Thanks
 

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
101
Trophies
0
Location
Houen Chihou
XP
1,408
Country
Russia
Hi, I have an NFTR font that's in Shift-JIS format, but the program detects in as UTF-8. I also can't seem to change it to Shift-JIS ("Edit > Reencode" does nothing). I also cannot seem to get the preview window to appear. The fonts I'm testing are from Kanji Sonomama Rakubiki Jiten DS. Thanks
Hi! Let me get some things out of the way first - neither the "Reencode" option nor the preview thing have been implemented yet, so they're not supposed to do anything yet...sorry, I hope I get around to implementing those features eventually. I just put those menu options in cause I planned for that stuff when starting this but again just haven't gotten around to focusing on this project some more to implement it.
As for the font being detected as UTF-8, does it decode the character values incorrectly then? It's kinda hard to tell what's exactly wrong just at a glance, so could you provide some more info on that?
 

Dionicio3

The Skiddo
Member
Joined
Feb 26, 2017
Messages
3,794
Trophies
2
Age
18
Location
Hollister, CA
Website
dionicio3.com
XP
4,539
Country
United States
Hi! Let me get some things out of the way first - neither the "Reencode" option nor the preview thing have been implemented yet, so they're not supposed to do anything yet...sorry, I hope I get around to implementing those features eventually. I just put those menu options in cause I planned for that stuff when starting this but again just haven't gotten around to focusing on this project some more to implement it.
As for the font being detected as UTF-8, does it decode the character values incorrectly then? It's kinda hard to tell what's exactly wrong just at a glance, so could you provide some more info on that?
1638312200074.png

yeah it's being detected as the wrong character, for example, デ is being detected as a completely irrelevant CJK Ideograph. Also, I just noticed that the codepoint box at the top right doesn't work for anything above 0x00FF
 

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
101
Trophies
0
Location
Houen Chihou
XP
1,408
Country
Russia
View attachment 287659
yeah it's being detected as the wrong character, for example, デ is being detected as a completely irrelevant CJK Ideograph. Also, I just noticed that the codepoint box at the top right doesn't work for anything above 0x00FF
Huh, so it really is loading it with the wrong encoding. Could you PM me file you're trying to open here so I can look into this more?
As for it being picked up as a CJK character, 0x8366 does seem like a valid SJIS code to me, so my guess is that either this file has an incorrect flag for the encoding or there's an error in my code somewhere.
And as for the spinbox being limited to 0xFF - that's supposed to happen since when UTF-8 is the encoding the program limits this value (and yes, I know that UTF-8 is a multi-byte scheme...but I honestly have no idea how the actual NintendoWare code deals with anything outside of 0xFF range...does it treat it as two separate codepoints or just treat it as invalid? This I still have to find out), so it's normal.
Also initially I was kinda weirded out by how the program looks in your screenshot, but then remembered Windows 11 is a thing lol
 
  • Like
Reactions: Dionicio3

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
101
Trophies
0
Location
Houen Chihou
XP
1,408
Country
Russia
View attachment 287659
yeah it's being detected as the wrong character, for example, デ is being detected as a completely irrelevant CJK Ideograph. Also, I just noticed that the codepoint box at the top right doesn't work for anything above 0x00FF
Looked into the files you sent, and they do indeed have the wrong flag for the encoding. Manually setting byte at offset 0x1F to 0x02 in a hex editor made it load as SJIS...but that's not everything lol
These files also seems to have a weird quirk - some glyph indices are defined twice in the font (so, one mapping in one CMAP, and another one is another...they both map the same code and index, but are duplicated for some reason) so even when it loads it with the correct encoding, it's still incorrect (and that's what causes the garbage glyphs at the end of the font file to show up...and that's cause I use the number of mappings in the CMAPs to count how many glyphs to load from CGLP, and so if the CMAPs are loaded incorrectly, then CGLP reading code may read garbage data). I've made a quick fix which merges these duped entries together and pushed it to GitHub. Attached a Windows build to this message. Try seeing if it works like this.
As for why the font could have duped entries, that I don't know. And I hope the game doesn't need the file to be like this in order for it to run.
 

Attachments

  • nintyfont-win32-02122021-93cc379.zip
    8.7 MB · Views: 2
  • Like
Reactions: Dionicio3

Dionicio3

The Skiddo
Member
Joined
Feb 26, 2017
Messages
3,794
Trophies
2
Age
18
Location
Hollister, CA
Website
dionicio3.com
XP
4,539
Country
United States
Looked into the files you sent, and they do indeed have the wrong flag for the encoding. Manually setting byte at offset 0x1F to 0x02 in a hex editor made it load as SJIS...but that's not everything lol
These files also seems to have a weird quirk - some glyph indices are defined twice in the font (so, one mapping in one CMAP, and another one is another...they both map the same code and index, but are duplicated for some reason) so even when it loads it with the correct encoding, it's still incorrect (and that's what causes the garbage glyphs at the end of the font file to show up...and that's cause I use the number of mappings in the CMAPs to count how many glyphs to load from CGLP, and so if the CMAPs are loaded incorrectly, then CGLP reading code may read garbage data). I've made a quick fix which merges these duped entries together and pushed it to GitHub. Attached a Windows build to this message. Try seeing if it works like this.
As for why the font could have duped entries, that I don't know. And I hope the game doesn't need the file to be like this in order for it to run.
Yeah it doesn't look like the game needs the duped entries, I tested by modifying the A glyph
1638494970107.png
 

Dionicio3

The Skiddo
Member
Joined
Feb 26, 2017
Messages
3,794
Trophies
2
Age
18
Location
Hollister, CA
Website
dionicio3.com
XP
4,539
Country
United States
I also just noticed that the font seems to use an extended version of Shift-JIS called something like "Shift-JIS 2004." I tried replacing "SHIFTJIS.TXT" with this file but the program didn't open

EDIT: Looking into it more, it doesn't seem to properly follow this extension and it uses its own weird extension.
 
Last edited by Dionicio3,

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
101
Trophies
0
Location
Houen Chihou
XP
1,408
Country
Russia
I also just noticed that the font seems to use an extended version of Shift-JIS called something like "Shift-JIS 2004." I tried replacing "SHIFTJIS.TXT" with this file but the program didn't open

EDIT: Looking into it more, it doesn't seem to properly follow this extension and it uses its own weird extension.
Well, good that it works lol

As for SJIS 2004 and stuff, it's really not a big surprise NintyFont doesn't start with that file since it uses a slightly different format, and the "parser" I wrote for SHIFTJIS.TXT obviously doesn't support it. Maybe I'll add that in, although I was thinking of embedding the data of both DerivedName.txt and SHIFTJIS.TXT into the program itself as to get rid of the dependency on these two external files; so maybe I could embed a conversion table for SJIS-2004 too and make a thingy to select between them or something. Tho that's just a thought and I'm not promising anything at this point, so no ETA lol

As for what this font actually uses, this seemed to remind me of the stuff I saw around NITRO SDK...in fact, I think there were documents detailing the encoding slots used for extended characters...although that was for Unicode only as far as I remember, tho then again maybe Japanese versions of the SDK had that, or heck maybe I just haven't looked close enough.
 
General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: "This just in... The pizza also contained Canadian bacon... I can't take it anymore... Canadian...