Homebrew Developing homebrew using a custom font

MaiconErick

Well-Known Member
OP
Member
Joined
Jan 4, 2016
Messages
140
Trophies
0
Age
28
XP
373
Country
Brazil
Hello,

I'm trying to learn how do I achieve this on a homebrew I'm developing.
I need to use a custom font mainly because I want to display Korean text on a USA 3DS.
Is there a template where I can study the functions needed to achieve that?
 
Last edited by MaiconErick,
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,947
Country
United States
Hello,

I'm trying to learn how do I achieve this on a homebrew I'm developing.
I need to use a custom font mainly because I want to display Korean text on a USA 3DS.
Is there a template where I can study the functions needed to achieve that?

DevKitPro, get the devkitARM version: https://devkitpro.org/wiki/Getting_Started

Be sure you have Cygwin , MinGW , Code::Blocks ???, Command Prompt, etc - to be able to run the "make" action.

Check this YouTube video in how to setup the DevKitPro folder on Windows:
3DS Homebrew Tutorial #1 - "Hello, World!"

You can look under the examples/3ds/graphics/printing/system-font/source for the main.c in how they coded for fonts. Good luck!

Edit: Refer to www.3dbrew.org and https://wiki.gbatemp.net/wiki/List_of_3DS_development_tools#Libraries_and_tools
 
Last edited by TurdPooCharger,

MaiconErick

Well-Known Member
OP
Member
Joined
Jan 4, 2016
Messages
140
Trophies
0
Age
28
XP
373
Country
Brazil
DevKitPro, get the devkitARM version: https://devkitpro.org/wiki/Getting_Started

Be sure you have Cygwin , MinGW , Code::Blocks ???, Command Prompt, etc - to be able to run the "make" action.

Check this YouTube video in how to setup the DevKitPro folder on Windows:
3DS Homebrew Tutorial #1 - "Hello, World!"

You can look under the examples/3ds/graphics/printing/system-font/source for the main.c in how they coded for fonts. Good luck!

Edit: Refer to www.3dbrew.org and https://wiki.gbatemp.net/wiki/List_of_3DS_development_tools#Libraries_and_tools

Yeah, I have developed a few homebrew already, I just don't know which functions to use. The "using a system font" on templates doesn't tell how to use an external font though. It doesn't work for displaying Korean characters on USA 3DS'.
 
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,947
Country
United States
Yeah, I have developed a few homebrew already, I just don't know which functions to use. The "using a system font" on templates doesn't tell how to use an external font though. It doesn't work for displaying Korean characters on USA 3DS'.

Damn, what a shame. I tested out some korean characters in one of the sample lines and all you get is ? boxes. My best guess is the glyphSheets is where those unique characters exist. Try checking if you can go copy and paste Korean text from the internet onto the Game Notes to see if North American 3DS is capable of rendering Korean.
 

MaiconErick

Well-Known Member
OP
Member
Joined
Jan 4, 2016
Messages
140
Trophies
0
Age
28
XP
373
Country
Brazil
Damn, what a shame. I tested out some korean characters in one of the sample lines and all you get is ? boxes. My best guess is the glyphSheets is where those unique characters exist. Try checking if you can go copy and paste Korean text from the internet onto the Game Notes to see if North American 3DS is capable of rendering Korean.
That's the thing, USA 3DS can't render Korean using the system font, that's why I need to use another font haha
 

MaiconErick

Well-Known Member
OP
Member
Joined
Jan 4, 2016
Messages
140
Trophies
0
Age
28
XP
373
Country
Brazil
That changes the system font itself. Isn't there a way to use a external .ttf file on my homebrew?
Or let's make it easier: What if I want to use Comic Sans only on my homebrew that I'm developing?
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,661
Country
France
I don't know if it can help you, as the Wii is probably different (using GX functions), but USBLoaderGX has a freeType reader/renderer.
https://sourceforge.net/p/usbloadergx/code/HEAD/tree/trunk/source/FreeTypeGX.cpp

it's not my code, I never had to read/use it, so I don't know if it can be useful for your project.

That file has maybe already been updated and used in other 3DS homebrew.
try to find a 3DS homebrew project with freetype sources.

edit:
3DS portlib seems to already use freetype, you probably already have portlib so maybe my comment wasn't useful, sorry.
 
Last edited by Cyan,
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,947
Country
United States
That changes the system font itself. Isn't there a way to use a external .ttf file on my homebrew?
Or let's make it easier: What if I want to use Comic Sans only on my homebrew that I'm developing?

https://gbatemp.net/threads/tutorial-customising-a-system-font.477415/
https://gbatemp.net/threads/some-custom-3ds-fonts.428464/
??? - I dunno if changing the system font applies on Homebrew apps.

Edit - Hey, have you checked the CTR_SDK? There's a FontConverter folder. Maybe that's it?
 
Last edited by TurdPooCharger,

Slattz

Easygoing Fairy
Member
Joined
Nov 21, 2015
Messages
1,259
Trophies
1
XP
1,787
Country
Ireland
I was talking to Nanquitas about this issue a couple of days ago as I too am experiencing the same problem in my homebrew. Apparently, an actual font loader would need to be created if you want to load a bcfnt file. ctrulib only maps and reads from the already loaded shared font (the system loaded the shared font already) and doesn't actually have support for loading fonts. So a loader is basically needed.

We were trying a hacky way but because ctrulib's charPerSheet is static, the method wouldn't work as an extern can't be used. It's possible to use an extern and change the g_sharedFont to your own address and set up your font's pointers and stuff, but because charPerSheet is static and can't be modified from your own code, it doesn't work unless the font you want to load has the exact same charPerSheet as the shared font.
 
Last edited by Slattz,

MaiconErick

Well-Known Member
OP
Member
Joined
Jan 4, 2016
Messages
140
Trophies
0
Age
28
XP
373
Country
Brazil
Well, I was able to use a different font, but Korean characters still aren't displayed. Just some boxes.
I wanted to display Korean text on my homebrew without messing with the system fonts :(
 
Last edited by MaiconErick,

MaiconErick

Well-Known Member
OP
Member
Joined
Jan 4, 2016
Messages
140
Trophies
0
Age
28
XP
373
Country
Brazil
I think I need another font renderer but it was hard enough to find this one..
Idk if I should open another thread asking for a way to display Korean text on a USA 3DS in a homebrew..
If you guys happen to know some homebrew that displays Korean text on a USA 3DS, let me know haha
FBI doesn't, GodMode9 doesn't..
 
Last edited by MaiconErick,

MaiconErick

Well-Known Member
OP
Member
Joined
Jan 4, 2016
Messages
140
Trophies
0
Age
28
XP
373
Country
Brazil
I was talking to Nanquitas about this issue a couple of days ago as I too am experiencing the same problem in my homebrew. Apparently, an actual font loader would need to be created if you want to load a bcfnt file. ctrulib only maps and reads from the already loaded shared font (the system loaded the shared font already) and doesn't actually have support for loading fonts. So a loader is basically needed.

We were trying a hacky way but because ctrulib's charPerSheet is static, the method wouldn't work as an extern can't be used. It's possible to use an extern and change the g_sharedFont to your own address and set up your font's pointers and stuff, but because charPerSheet is static and can't be modified from your own code, it doesn't work unless the font you want to load has the exact same charPerSheet as the shared font.
ACG Shared Font Tool does that, it changes the system's bcfnt file. I can display Korean text using the "system-font" template of devkitPRO if I change the bcfnt file with ACG.
Now that I found the source file, I'll try to add the functionality to my homebrew. I'll try with 1.2 version, it looks cleaner than 2.0.
If you want to do that too..
 

Slattz

Easygoing Fairy
Member
Joined
Nov 21, 2015
Messages
1,259
Trophies
1
XP
1,787
Country
Ireland
ACG Shared Font Tool does that, it changes the system's bcfnt file. I can display Korean text using the "system-font" template of devkitPRO if I change the bcfnt file with ACG.
Now that I found the source file, I'll try to add the functionality to my homebrew. I'll try with 1.2 version, it looks cleaner than 2.0.
If you want to do that too..
Ah, but that changes the entire shared font that's in memory, meaning the changed font work outside the homebrew. I was talking about if you only want to change it for your homebrew, not the entire system :P
 
  • Like
Reactions: MaiconErick

MaiconErick

Well-Known Member
OP
Member
Joined
Jan 4, 2016
Messages
140
Trophies
0
Age
28
XP
373
Country
Brazil
Ah, but that changes the entire shared font that's in memory, meaning the changed font work outside the homebrew. I was talking about if you only want to change it for your homebrew, not the entire system :P
Yeah.. But that's the only way I was able to come up with.
I'll change the system font when my homebrew opens, and restore it when it exits.
When you have a better solution, please let me know. :)
 
  • Like
Reactions: Slattz

Slattz

Easygoing Fairy
Member
Joined
Nov 21, 2015
Messages
1,259
Trophies
1
XP
1,787
Country
Ireland
Yeah.. But that's the only way I was able to come up with.
I'll change the system font when my homebrew opens, and restore it when it exits.
When you have a better solution, please let me know. :)
The problem is if your app crashes or something and doesn't actually reach the code to restore the sysfont. Though I think a restart of the console will reset the font anyways.
But yea, that seems like the only viable way for now.
 
  • Like
Reactions: MaiconErick

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    MrNoobNub @ MrNoobNub: why is everyone so horny