gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > ffont - 256 color variable width font rendering

#129705 - fogzot - Fri May 25, 2007 12:48 pm

I wanted something quite simple to start hacking, just to see if I had grasped the tutorials and 8-bit font rendering using the small banks seemed just right. The result is a little library that render "paletted", variable width fonts (generated using the included ffontmaker program, that works on Linux/Mono or Windows) applying some very basic effects like color remapping, background color and transparent foreground (I have a problem here, see below.) This is just a first try but I'd like to add some features (mainly text formatting and scrolling) in the future. Anyway, source code is available under the LGPL (GPL for the ffontmaker program) from here:

http://people.initd.org/fog/ffont-0.1.tar.gz

Now to my problem. There is any way, when using any 2D mode and BG_BMP8_256x256, to tell the video system that a color is "transparent" and the underlying background should show through? I am a bit confused here because I don't understand if, for example, it is possible to have TWO BG_BMP8_256x256 backgrounds with the lower one showing through holes in the top one. Any example out there?

#129707 - tepples - Fri May 25, 2007 12:58 pm

fogzot wrote:
I wanted something quite simple to start hacking, just to see if I had grasped the tutorials and 8-bit font rendering using the small banks seemed just right.

There is only one small bank that allows a full-screen 8-bit bitmap: bank E. The others aren't at least 48 KB.

Quote:
Now to my problem. There is any way, when using any 2D mode and BG_BMP8_256x256, to tell the video system that a color is "transparent" and the underlying background should show through?

Pixel value = 0

Quote:
I am a bit confused here because I don't understand if, for example, it is possible to have TWO BG_BMP8_256x256 backgrounds with the lower one showing through holes in the top one.

Only in banks A-D. Otherwise, there isn't enough VRAM.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#129708 - fogzot - Fri May 25, 2007 1:09 pm

tepples wrote:
fogzot wrote:
I wanted something quite simple to start hacking, just to see if I had grasped the tutorials and 8-bit font rendering using the small banks seemed just right.

There is only one small bank that allows a full-screen 8-bit bitmap: bank E. The others aren't at least 48 KB.

Yep, but you can do some tricks. The only example included, for example, uses banks H+I to make up 48kb for the sub screen. Also, if you only need text in 2/3 or 1/3 of the screen you can use the small banks with appropriate offset. Well.. if I understand the whole banks stuff, anyway.

tepples wrote:
Pixel value = 0

Mm.. so in my tests I did something wrong. I'll try again, thank you.