Homebrew Fonts compatible with devkitarm (or how to make them!) (libnds)

kerneldev

Active Member
OP
Newcomer
Joined
Jan 11, 2012
Messages
26
Trophies
0
Location
The Mud Ball
XP
53
Country
United States
Hi,

I've been compiling resources for homebrew fonts suitable for the DS:
  • http://www.proggyfonts.com/index.php?menu=download
  • http://www.angelcode.com/products/bmfont/
But thus far I've been unable to grok how the fonts, especially TTF ones, can be converted to a BMP bitmap font suitable to be used with libnds. I'm writing a tool I plan on releasing when it has produced fruits (it has to do with investigating the DS mode in 3DS) and would love to be able to use crisp fonts rather than the default console one (which looks mildly wrong with DeSmuME).

Can anybody help with understanding how to create fonts for libnds? Perhaps a HOWTO?
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
30,850
Trophies
3
Location
Gaming Grotto
XP
29,934
Country
Poland
It's my understanding that the DS may use two types of fonts - based on a tiled background, where each tile represents one letter, and those are made quite easily, since all you have to do is put each letter in its corresponding "slot" and fonts that are actively drawn on-screen on a bitmap-like layer, difference being that tiled fonts cannot be resized and take less space while drawn fonts work exactly the same as their equivalents on the PC.

I have no idea how to create the latter, but for the former you may dig up a program called dsFont which will do most of the work for you, leaving you with a pre-rendered image with each letter in a separate tile for you to "re-touch" where needed. If you won't be able to find it, PM me for a copy - it's freeware.
 

Kiiro_Yakumo

Kitsune
Member
Joined
Apr 14, 2009
Messages
400
Trophies
1
Location
Gensokyo
Website
clash-of-gods.netau.net
XP
405
Country
Poland
Foxi4 You are 100% correct, that's how it goes
Basically (but not exactly) it's like this
- Free Line
- Special characters and numbers
- Capital Letters
- Small Letters
It's not exact because explaining it from table would take a bit of time...but idea is the same, it's BMP image with letters, symbols and numbers in their proper "slots" (XY positions)
Dunno, maybe Devkitpro has example image somewhere? Like in "text" examples?
 

Schmendrick

Well-Known Member
Newcomer
Joined
Sep 12, 2009
Messages
55
Trophies
0
Website
www.dennisvanzwieten.com
XP
166
Country
Netherlands
Another option is to use the 3D engine to display text. I made a little program that takes a font pcx file, and adds a header in front of it containing letter sizes. Then I just use the 3D engine to draw quads with the proper uv coordinates. Works like a charm! And without too much extra work allows you to scale and rotate everything.
 

LeRodeur

Well-Known Member
Member
Joined
Dec 12, 2009
Messages
162
Trophies
0
Age
31
XP
200
Country
France
Another option is to use the 3D engine to display text. I made a little program that takes a font pcx file, and adds a header in front of it containing letter sizes. Then I just use the 3D engine to draw quads with the proper uv coordinates. Works like a charm! And without too much extra work allows you to scale and rotate everything.
Would be easier to do as said before, make a bmp with your file, convert it into a tileset in the good order with the ascii table so that when you have to draw a string you only have to do something like this
For(i=0;*sting != /0;i++)
Bgmap[x+(x+i)%32][y+(x+i)/32]=*string;
string++;

You could also check for /n etc
the latter tool should place the characters in the right order
the only problem is that you can't make your characters of various sizes
 

Schmendrick

Well-Known Member
Newcomer
Joined
Sep 12, 2009
Messages
55
Trophies
0
Website
www.dennisvanzwieten.com
XP
166
Country
Netherlands
Yes, using a tiled bg may be easier, but much less flexible. My text system uses identical font images (or tilesets), it just uses the 3D engine to render them to the screen, and it allows for non-fixed width text, custom colors, etc. Anyway, I just figured I'd give another alternative to writing text to the screen :)
 

LeRodeur

Well-Known Member
Member
Joined
Dec 12, 2009
Messages
162
Trophies
0
Age
31
XP
200
Country
France
Actually, if he meant a font compatible with the iprintf function from libnds, it will be a bit more difficult to generate, as libnds seems not use the ascii, but a slightly different one (used in all nintendo ds games? with strange smileys etc)
to see the table just use this litle code:
Code:
int i;
char test[256];
for (i=1;i
 

CoolAs

Well-Known Member
Newcomer
Joined
Oct 21, 2011
Messages
75
Trophies
0
XP
109
Country
Hrm, well I know that Dirbaio made a .ttf to .bin (Dirbaio's own format) converter.
Then he wrote some code to print user specified characters and strings (using the font from the .bin file) onto a bitmap background. It was commited to the home-smash svn repo ages a go... then was deleted.
But if you checkout the current revision then run "svn update -r x" (replacing x fom 0 to 24) untill you find the font printing code... You will still have to ask him for the converter though - that was not commited at all, and I don't have a copy of it.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: https://youtu.be/q1474nWP0bI?si=5v445vycfskxD3V8