Page 1 of 1

Issues with dsb_get_font

Posted: Wed Apr 10, 2013 8:20 am
by Lord_BoNes
While trying to add the brown wall text from DM2, I've hit a roadblock... attempting to load a file with dsb_get_font crashes DSB, telling me it can't find the file :?
If I try to load a PNG file, it crashes DSB unable to find it.
If I try to load a BMP or PCX file, it seems to get a little further, but then bombs out with a seg fault.

The end result is that I can't seem to load a new font :(

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 10:17 am
by Gambit37
Fonts must be in a very specific Allegro format. It requires a grid, separated by specific colours. Have you created one of those?

Also, this is one function that REQUIRES the font PCX to be in your dungeon folder (it doesn't work with PNGs for some reason and you can't have fonts in different folders).

I do think all the graphics handling functions should be made consistent so that any graphic can be put in any folder and PNGs are always supported. It's a bit odd to have weird exceptions like this.

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 3:35 pm
by Lord_BoNes
Yes, I have the text on a grid. All I did was take the original DSB wall_font.pcx, alter the palette (so the text was brown instead of grey) and then save it as a PNG, in a sub-folder.

I agree. All the graphics handling functions need to be made consistent. It was odd bumping into this alright :P

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 4:23 pm
by Lord_BoNes
I tried saving the file as a PCX file, and put it in my dungeon's root-folder... to no avail... segmentation fault :(

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 4:31 pm
by Gambit37
It's been a while since I've fiddled with fonts, but I do recall I had lots of problems initially too.
It maybe that you don't have the right 8bit or 24bit format.
I'll send you a PM with my email address in it and you can send me your file for me to look at.
By the way, if the font is a single colour, make it in white, then you can recolour it in code rather than having to mess about with colouring bitmaps externally.

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 6:49 pm
by Lord_BoNes
It seems that my issue was my graphics handling program (IrfanView) slightly altering the RGB of the image file... which DSB didn't like :P

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 6:55 pm
by Lord_BoNes
On a related note: Why my does walltext appear as very small text (instead of the usual size)? All I've done is clone the original walltext item, and altered the front/side/font values... everything else is left alone... and yet, my walltext is about 1/2 to 1/3 the size of normal walltext :?

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 7:17 pm
by Gambit37
Oh yeah, I forgot to mention, you need to pixel-double it, your bitmap was the original DM resolution. You need double for DSB.

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 7:53 pm
by Lord_BoNes
Ahh... makes sense. Thanx

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 8:27 pm
by Sophia
Gambit37 wrote:I do think all the graphics handling functions should be made consistent so that any graphic can be put in any folder and PNGs are always supported. It's a bit odd to have weird exceptions like this.
You develop with PHP, so you should be used to this kind of thing. ;)

Seriously, though, I think part of the issue may be some old documentation floating around-- for example, dsb_get_font already supports a long name different from the short name, like the other bitmap loading functions. This wasn't always the case, but it is now.

As for PNG support, there's really no reason to. DSB fonts can't have alpha channels and they can't and won't unless I make substantial rewrites to the Allegro font renderer... which is not something I have any intention of doing. So, sure, adding support for PNG images is easy, but then someone would inevitably complain about alpha channels not working and we'd just be back here...

Re: Issues with dsb_get_font

Posted: Wed Apr 10, 2013 8:41 pm
by Lord_BoNes
Image
Here's my finished DM2 wooden wallpanel, complete with some "brown text" :P