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

  • Thread starter Thread starter kerneldev
  • Start date Start date
  • Views Views 3,884
  • Replies Replies 8

kerneldev

Active Member
Newcomer
Joined
Jan 11, 2012
Messages
26
Reaction score
4
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?
 
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.
 
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?
 
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.
 
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
 
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 :)
 
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
 
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