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.

DarkBASIC Discussion / Bitmap font in DBC

Author
Message
No Time To Code
17
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 7th Jan 2009 03:45
I'm looking for info on how to do Bitmapped fonts in DBC. I've searched the forums and codebase but only found this info for DBP.
I'm working on pacman (based on DBP tutorial) and want to use the 80's style chunky graphics. I've downloaded .ttf fonts with this style but when I use TEXT command in the game, the text doesn't look the same as when I view the font in MSWord. I assume that's because of the resolution/# of pixels make the text look too smooth.
Any suggestion on how to :
1. Get the .ttf fornt to look correct in the game OR
2. How to convert .ttf to bitmap and use bitmap fonts in DBC

Thanks!
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 7th Jan 2009 13:31 Edited at: 7th Jan 2009 13:32
Quote: "I've downloaded .ttf fonts with this style but when I use TEXT command in the game, the text doesn't look the same as when I view the font in MSWord."

How is the text different? Is it just the plain, bog standard "system" font when you expected something fancier? If so, they you need to use:

The optional value is important in DB1.20. In the past if it wasn't specified then it defaulted to one, but now it has to be specified and the help files haven't been updated to tell you!

Other than that, I'm afraid I don't really know what's going wrong.

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
No Time To Code
17
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 7th Jan 2009 16:49
Robert,

I'm not sure what the optioanl value of one is supposed to do but I tried it and nothing seemed to change. I confimed with the TEXT FONT$() command that it is using with the font I selected. The problem is that it looks too smooth and not blocky like it looks in MS Word and MSPaint. I going to try to include two picture to show what I'm talking about but I'm not sure how to do it so I hope this works.......
[img]C:\Documents and Settings\Tom\My Documents\My Pictures\80styletext.bmp[/img]
[img]C:\Documents and Settings\Tom\My Documents\My Pictures\pacmanscrn.bmp[/img]
No Time To Code
17
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 7th Jan 2009 17:13
I see from my previous post that I didn't include the images correctly. Any help on how to do it?
You can download the way the text looks in my game on the previous post. The download for how it looks in MSWord or MSPaint is in this post
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 7th Jan 2009 19:04 Edited at: 7th Jan 2009 19:05
Well you can always write your own "place text on screen" routine. Get an image with all the letters/charaters, use your routine to cut them up into individual pictures and paste them onto the screen accordingly.

Dont always have to use the Text command to output text.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 8th Jan 2009 04:09
The optional ,1 is the language character set. 1 = English. There are other character sets for different languages. The inclusion of the character set is necessary to size the text correctly.



Enjoy your day.
No Time To Code
17
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 8th Jan 2009 06:44
Latch,

I did try it with the optional ,1 but as you can see from the pictures (downloads above), the font does not look the same in the game as it does in MSWord or MS Paint.

Could you tell me how to include the images in the post? I clicked the image button like so....[img]null[/img]

But I'm not sure how to include my picture in place of the "null"
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 8th Jan 2009 09:38
To include the images in the post as an image within the post, you'll need to have them stored on an internet site and reference them from there according to their URL(s). That's where the image button comes in. Or you can upload them like you have been. If you upload them, make sure they are pngs so a view button appears and they are smaller in bytes.

Quote: "I did try it with the optional ,1 but as you can see from the pictures (downloads above), the font does not look the same in the game as it does in MSWord or MS Paint."

From the look of the text in the game, it would seem that the default text in DBC is being used (arial). That could mean that when you are using the command SET TEXT FONT "name",1 the name is being spelled incorrectly or the font is not being recognized.

Also, font selections won't change if you use the Print command. You have to use the Text command.

Or, like Ashingda Suggested, use a bitmap and get the image of each letter/number. To do this, Just type the alphabet and numbers out in Paint at a certain size. Make sure each position that the letter is typed is the same height and width then save the bitmap. In DBC, load the bitmap then capture an image of each character position using Get Image num,<leftx>,<topy>,<rightx>,<bottomy>

Enjoy your day.
No Time To Code
17
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 9th Jan 2009 02:06
Quote: "From the look of the text in the game, it would seem that the default text in DBC is being used (arial). That could mean that when you are using the command SET TEXT FONT "name",1 the name is being spelled incorrectly or the font is not being recognized."

I am using the Set Text Font


I used the TEXT FONT$() command to confirm that the program is using the "prstart" font.

I guess I will have to use the bitmap. I know how to get the images. As far as using them in the game, like numbers for the score, I guess I have to use some type of ASCII code to convert the number value to the bitmapped image of the number. I know there are some code snippets about doing this in DBP. I assume it's similar for DBC?
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 9th Jan 2009 16:07 Edited at: 9th Jan 2009 16:08
Well, you can easily look up the ascii codes with:



Assign the image(s) an ascii number. Then for any value you want returned as a bitmap, you convert the value to a string, then get each ascii from the individual positions in the string. If the value to convert to images is already a string, like the word Pacman or something, then you don't have to use the Str$() conversion of a numeric value to a string.



Enjoy your day.
No Time To Code
17
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 11th Jan 2009 16:38
Thanks again Latch. Sounds easy enough, I'll give it a shot!

Login to post a reply

Server time is: 2026-07-06 10:01:34
Your offset time is: 2026-07-06 10:01:34