Homebrew [PSA] Be careful using/creating custom system fonts.

PabloMK7

Red Yoshi! ^ω^
OP
Developer
Joined
Feb 21, 2014
Messages
2,603
Trophies
2
Age
24
Location
Yoshi's Island
XP
4,991
Country
Spain
Hello there! Recently I've got some complaints in my CTGP-7 discord server that the mod was either crashing or showing garbled text. It turned out the reason for those crashes and bugs was the usage of custom system fonts so I decided to make this thread to explain why that happens and how to prevent it.

What symptoms do buggy custom system fonts cause?
  • Garbled text, black squares, white squares or no text at all.
  • Missing characters and symbols, such as button symbols, special characters, etc
  • Crashes in homebrew apps or even official games.
Known homebrew applications having issues with custom system fonts:
  • CTRPF: Either the text is garbled or crashes.
  • FBI: Some custom fonts can cause crashes, preventing you from restoring the original working system font.
Why does that happen?

Custom system fonts are commonly saved with A8 color encoding. While many official apps are designed to support all the possible encodings, there are some situations where that isn't the case. The original system font is saved with A4 color encoding which uses less bits per pixels, apps that assume the system font is saved with A4, will show garbled text or will crash randomly.
Another problem is that A8 bcfnts are much bigger than the official one, taking more memory (shouldn't be a big issue tho).

As a user trying to install a custom font, what should I do?

You can always check if the custom font is properly created, for that do the following:
  1. Get 3dsfuse
  2. Open 3dsfuse and mount the custom system font cia
  3. Go to the new mounted cia->(folder with numbers)->romfs and grab the bcfnt.lz file you can find inside.
  4. Get 3dstool and put both the bcfnt and the exe in the same folder.
  5. Run "3dstool -uvf cbf_std.bcfnt.lz --compress-type lzex --compress-out file.bcfnt" in a command prompt, search in google how to execute commands in the command prompt if you don't know how.
  6. Open the new created file.bcfnt in a hex editor such as HxD and check the value circled in this screenshot. If the value is 0B then it is a good font and can be used without any problems. If the value is another one (the most common being 08 then it is a buggy custom system font.) NOTE: Changing that value to 0B won't fix it, but will make it worse :P
As a developer trying to create a custom font, what should I do?

Check the following link to see how custom fonts should be properly created: https://pastebin.com/ZCy0uzux
 
Last edited by PabloMK7,
D

Deleted User

Guest
Thanks for the solution. I'm gonna fix/redo dozens of my custom fonts if I have much free time.
 
D

Deleted User

Guest
Just want to add: If you install a bad font using FBI, reinstalling a reliable font may not be as easy, since FBI also crashes with certain fonts.
 
  • Like
Reactions: PabloMK7

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,182
Trophies
4
Location
Space
XP
13,693
Country
Norway
Hello there! Recently I've got some complaints in my CTGP-7 discord server that the mod was either crashing or showing garbled text. It turned out the reason for those crashes and bugs was the usage of custom system fonts so I decided to make this thread to explain why that happens and how to prevent it.

What symptoms do buggy custom system fonts cause?
  • Garbled text, black squares, white squares or no text at all.
  • Missing characters and symbols, such as button symbols, special characters, etc
  • Crashes in homebrew apps or even official games.
Known homebrew applications having issues with custom system fonts:
  • CTRPF: Either the text is garbled or crashes.
Why does that happen?

Custom system fonts are commonly saved with A8 color encoding. While many official apps are designed to support all the possible encodings, there are some situations where that isn't the case. The original system font is saved with A4 color encoding which uses less bits per pixels, apps that assume the system font is saved with A4, will show garbled text or will crash randomly.
Another problem is that A8 bcfnts are much bigger than the official one, taking more memory (shouldn't be a big issue tho).

As a user trying to install a custom font, what should I do?

You can always check if the custom font is properly created, for that do the following:
  1. Get 3dsfuse
  2. Open 3dsfuse and mount the custom system font cia
  3. Go to the new mounted cia->(folder with numbers)->romfs and grab the bcfnt.lz file you can find inside.
  4. Get 3dstool and put both the bcfnt and the exe in the same folder.
  5. Run "3dstool -uvf cbf_std.bcfnt.lz --compress-type lzex --compress-out file.bcfnt" in a command prompt, search in google how to execute commands in the command prompt if you don't know how.
  6. Open the new created file.bcfnt in a hex editor such as HxD and check the value circled in this screenshot. If the value is 0B then it is a good font and can be used without any problems. If the value is another one (the most common being 08 then it is a buggy custom system font.) NOTE: Changing that value to 0B won't fix it, but will make it worse :P
As a developer trying to create a custom font, what should I do?

Check the following link to see how custom fonts should be properly created: https://pastebin.com/ZCy0uzux
So this isn't really an issue with the fonts. It's an issue with dumb homebrews being hardcoded to only accept a certain format. I think it would be better if the buggy homebrews were edited to make them behave the same way official software does.
 

PabloMK7

Red Yoshi! ^ω^
OP
Developer
Joined
Feb 21, 2014
Messages
2,603
Trophies
2
Age
24
Location
Yoshi's Island
XP
4,991
Country
Spain
dumb homebrews being hardcoded to only accept a certain format.
That's both stupid and rude to the respective homebrew developers. When a file is being replaced by another one, you should always keep the file format 100% equal, otherwise expect problems to happens. Moreover I have mentioned that even official games suffer this problem.
 

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,182
Trophies
4
Location
Space
XP
13,693
Country
Norway
That's both stupid and rude to the respective homebrew developers. When a file is being replaced by another one, you should always keep the file format 100% equal, otherwise expect problems to happens. Moreover I have mentioned that even official games suffer this problem.
I don't see how.
Official software supports it, so why shouldn't homebrew support it? Official software defines the standard for how homebrew should behave and the goal should always be to get homebrew behaving as closely as possible to official software.
It's likely that homebrew devs never considered that this might be a problem in the future, and I certainly don't blame them for that if that's what you think. But it's good coding practice to not hardcode things unless necessary. You never know if Nintendo might change something in the future that breaks homebrew due to things being hardcoded. That doesn't just apply to this, it applies to all things related to the system software.
 
Last edited by The Real Jdbye,
  • Like
Reactions: Miku-sensei

Deleted member 424658

Annoying Weaboo Girl
Member
Joined
Jun 4, 2017
Messages
499
Trophies
0
Age
24
Website
www.reddit.com
XP
677
Country
United States
I don't see how.
Official software supports it, so why shouldn't homebrew support it? Official software defines the standard for how homebrew should behave and the goal should always be to get homebrew behaving as closely as possible to official software.
It's likely that homebrew devs never considered that this might be a problem in the future, and I certainly don't blame them for that if that's what you think. But it's good coding practice to not hardcode things unless necessary. You never know if Nintendo might change something in the future that breaks homebrew due to things being hardcoded. That doesn't just apply to this, it applies to all things related to the system software.
Custom Fonts still don't work properly in many games. Smash 4's text is all broken using custom fonts.
 
  • Like
Reactions: Deleted User

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,182
Trophies
4
Location
Space
XP
13,693
Country
Norway
Custom Fonts still don't work properly in many games. Smash 4's text is all broken using custom fonts.
I see, that changes things slightly. Although that was probably an oversight on Nintendo's part, since you'd think that if the 3DS supports the format then it would work. Anyway, converting fonts to A4 is easy enough.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: Good night