Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Need help with bitmap fonts

Author
Message
D_dredar
15
Years of Service
User Offline
Joined: 6th Jun 2009
Location: The Nevada Desert
Posted: 11th Jul 2009 03:01
I need a Bitmap Fonts tutorial for dummies. I've tried looking at the on on Scraggle's web site, but the source code to go with the tutorial will not download. So the tutorial looks to be useless without it.

I'm also the type of person that needs to know how the code is working and not just plug in another persons code.

"GOTTA HAVE MORE COW BELL, BABY!!!!!
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 11th Jul 2009 03:17
What are you specifically trying to do?

D_dredar
15
Years of Service
User Offline
Joined: 6th Jun 2009
Location: The Nevada Desert
Posted: 11th Jul 2009 06:53
Well, I've been looking at other peoples examples of bitmap fonts. They show the all the letters in a single bitmap image and I’m trying to figure out, and understand how to extract the individual letters. And then how to get them into my program experiments with the correct spacing.

"GOTTA HAVE MORE COW BELL, BABY!!!!!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Jul 2009 09:19 Edited at: 11th Jul 2009 09:26
Quote: "I need a Bitmap Fonts tutorial for dummies."


The bitmap font itself needs to be in the same order as the ASCII list to make it easier to paste the right images for each letter/number/symbol using the ASC() command.

The images should be in this order:


The first character is space which is number 32 on the ASCII chart, the explanation point is number 33, quote is number 34 and so on till number 126 which is ~. Sometimes (like in this example) there are only higher case letters so the whole list isn't needed. We grab each letter with a different image number so each individual character is saved by itself. We generally start the image number higher so we don't have the first bitmap image starting at 32 (giving us some room for other images in our program). In the following code snip 100 is added to the image number so the space is 132.

When you use the ASC() command with text it returns the ASCII chart number of that character... so if your string is "HELLO" it returns (looking at each character separately), 72, 69, 76, 76, 79. Add 100 to each of those and you know that pasting image numbers 172, 169, 176, 176, 179 will show HELLO with the bitmap font.



Attachments

Login to view attachments
D_dredar
15
Years of Service
User Offline
Joined: 6th Jun 2009
Location: The Nevada Desert
Posted: 11th Jul 2009 23:12
Thanks Grog Grueslayer

That code looks more straight forward and readable than others I have looked at.

Rest assured that Ill be posting lots of questions until I understand everything I want to learn.

"GOTTA HAVE MORE COW BELL, BABY!!!!!
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 12th Jul 2009 08:42
I'm a DBPro newbie myself, so I could be totally wrong, but when you load the font graphic into a bitmap, you don't need to make individual images for each character. I believe you can just cut and paste from the bitmap to wherever you want the characters.

You would have to know where each character begins and ends, of course. You could have a table of "startpoints", holding each character's starting x value. Then the ending x value would be one pixel less than the next character's starting point.

That would give you proportional character spacing.

Rich
D_dredar
15
Years of Service
User Offline
Joined: 6th Jun 2009
Location: The Nevada Desert
Posted: 13th Jul 2009 01:58
For the most part, I've been able to use the code you provided to create my own to create the individual fonts. I have not figured out how to get the print function to work correctly. I'm either getting black squares or random characters. And as Dark Richard alluded to the spacing is wrong. But I’m sure I can work around that.

Another question, is it possible to set multiple Image ColorKeys? Or some other way to filter out the colors I don’t want to show?

"GOTTA HAVE MORE COW BELL, BABY!!!!!

Login to post a reply

Server time is: 2024-11-25 04:35:17
Your offset time is: 2024-11-25 04:35:17