#71640 - kevinc - Mon Feb 13, 2006 9:03 pm
Probably topping the list of the least needed projects for the DS, I wrote during the weekend a quick hack of a Truetype font reader/renderer:
[Images not permitted - Click here to view it]
Source
Curve straightening is not implemented yet, so if you scale it too much up you'll notice the jagged edges. It worked with all the fonts I threw it, but it's far from perfect, so if you have one that doesn't work please give me a link ^_^
#71719 - Darkflame - Tue Feb 14, 2006 2:40 am
Least needed in terms of funcationality maybe, but its still very good work :)
Especialy as some of us our hopeing to make our DS's as compatible with standard pc formats as possible.
#71753 - Snuk the Great - Tue Feb 14, 2006 7:01 am
Hmm, i didn't get it to work, but you probably got to recompile the nds with the fonts, or did it just not work for me :P. The idea is pretty great though!
#71754 - Dudu.exe - Tue Feb 14, 2006 7:14 am
its a good step to make a browser!
_________________
http://flickr.com/photos/stuffbox
#71789 - kevinc - Tue Feb 14, 2006 3:14 pm
Snuk the Great wrote: |
Hmm, i didn't get it to work, but you probably got to recompile the nds with the fonts, or did it just not work for me :P. The idea is pretty great though! |
You need to put the fonts somewhere and then tell InitFont a pointer to where to read it. It only needs InitFont(), setForegroundColor() and drawText() with someplace to draw, the rest is optional.
Did it get past the loading or does it get stuck on the drawing?
#71973 - radical_ratzor - Wed Feb 15, 2006 7:32 pm
Brilliant. I can't compile the code myself though so i'll be waiting for a .ds.gba file or something of that ilk.
Great work though kevinc, can't wait to try it out. I design fonts now and again as a graphic designer, and this program would be a great way to have them handy on the move.
I've got an interview in a few weeks so I can pimp it then ^_^
Well done mate,
Rat
_________________
Roll on over, to DrunkenCoders!
#71988 - tepples - Wed Feb 15, 2006 9:21 pm
radical_ratzor wrote: |
I design fonts now and again as a graphic designer |
What is the affordable program to enter font outlines into a Windows PC?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#71999 - kevinc - Wed Feb 15, 2006 10:09 pm
radical_ratzor wrote: |
Brilliant. I can't compile the code myself though so i'll be waiting for a .ds.gba file or something of that ilk.
|
There is a ds.gba file in the zip (with the extension .nds.nds, so it doesn't give trouble with my SCSD) if you want to try it on the hardware :) ; it just draws what's in the screenshot and then stops.
#72583 - TheChuckster - Mon Feb 20, 2006 3:10 am
If there was a way to have it NOT do antialiasing, it would be perfect. At the small font sizes I'm working with for my program, antialiasing just makes it blurry and unreadable. Also, my background isn't a solid color, so there are visible artifacts surrounding the text.
#72640 - Sylfurd - Mon Feb 20, 2006 6:46 pm
It looks really cool !
But it doesn't work on my GBAMP :/
I had the same idea but I haven't found documentation on the ttf file format ...
Great you realized it with subpixels fonts :)
It's a step to a web browser and to a great text editor !
Edit: Ok you use GBFS, it's not currently compatible with GBAMP :/
#74313 - StoneCypher - Sat Mar 04, 2006 7:42 am
Neat. I mean, I use freetype, but that's neat.
To fix your subpixel antialiaser, do a two-stage low pass filter at 1/3 downward each. that way the energy distribution is theoretically perfectly even across the color subchannels no matter which actual column is used, and as a result you don't get those color fringes.
Code: |
1
/ | \
1/3 1/3 1/3
/ | \ / | \ / | \
1/9 2/9 3/9 2/9 1/9
|
If that doesn't make sense, find me on #dsdev on efnet and i'll explain.
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#74321 - M3d10n - Sat Mar 04, 2006 11:50 am
tepples wrote: |
radical_ratzor wrote: | I design fonts now and again as a graphic designer |
What is the affordable program to enter font outlines into a Windows PC? |
Well, Corel Draw can export TTF files. Not quite an specialized tool, but it did the job when I had to create a font for a college project.
#74326 - kevinc - Sat Mar 04, 2006 2:33 pm
StoneCypher wrote: |
Neat. I mean, I use freetype, but that's neat.
To fix your subpixel antialiaser, do a two-stage low pass filter at 1/3 downward each. that way the energy distribution is theoretically perfectly even across the color subchannels no matter which actual column is used, and as a result you don't get those color fringes.
If that doesn't make sense, find me on #dsdev on efnet and i'll explain. |
Thanks! I was really getting tired at what a friend baptized the "semaphore artifacts" (red, green and yellow pixels).
#74339 - tepples - Sat Mar 04, 2006 4:43 pm
Any FIR filter with a zero at f/3 (even [1 1 1]/3) should work. I've been told [1 2 2 1]/6 and [1 3 4 3 1]/12 are good candidates that kill color fringing without introducing too much extra blurring. But make sure to gamma correct your palettes, as these filters work in linear intensity space, while the DS display (like the PC display) has a gamma close to 2.2.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
Last edited by tepples on Tue Mar 07, 2006 2:30 am; edited 1 time in total
#74627 - thoduv - Mon Mar 06, 2006 4:09 pm
Hi !
I want to use your program in my Ds App, but it appears that your program has some memory problems, for example in function copyBuffer.
It will be great if you fix these bugs and update your lib !
Thanks !
-Thoduv;
(I've forgotten: I change all the "new" to malloc() and delete to free() : here is the C-compatible version : http://thoduv.free.fr/p/nds/dstype.c
EDIT: After a few test, it work with the C++ version ...
#110470 - Lick - Tue Nov 28, 2006 8:35 pm
Topic! Live again!
Hey kevinc, or anyone.. I'm currently trying to use dsType, but nothing is showing up. I've tried MODE_FB0 and MODE_FB1, no luck though.
The font is renamed to .bin and put in the data folder.
Code: |
int main(void)
{
powerON(POWER_ALL);
lcdMainOnTop();
irqInit();
irqSet(IRQ_VBLANK, 0);
irqEnable(IRQ_VBLANK);
videoSetMode(MODE_FB1);
vramSetBankA(VRAM_A_LCD);
vramSetBankB(VRAM_B_LCD);
dsType_SetBackgroundColor(0xfD44);
dsType_SetForegroundColor(0xfDff);
dsType_SetHeight(12);
dsType_InitFont((char*)myriadc_bin);
dsType_SetAAMode(DSTYPE_AANORMAL);
dsType_DrawText("Thaomoa no12392108 asdasd ", (u16*)VRAM_A, 256);
dsType_Finish();
swiWaitForVBlank();
while(1);
}
|
_________________
http://licklick.wordpress.com