Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 677 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Bitmap Font Processing? #283495
08/08/09 00:20
08/08/09 00:20
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Hi, i'm trying to add support for bitmap fonts my app, 3DGS Easy Scripter. TrueType fonts are no problem but i'm unsure exactly how bitmap fonts work.

Is there an algorithm or something? What is the significance of the size having to be excatly 11, 128 or 256 times bigger?

Thanks.

Re: Bitmap Font Processing? [Re: DJBMASTER] #283690
08/09/09 10:28
08/09/09 10:28
Joined: Jul 2008
Posts: 894
T
TechMuc Offline
User
TechMuc  Offline
User
T

Joined: Jul 2008
Posts: 894
imagine a bitmap font just as a big Bitmap containing a collection of 11, 128 or 256 bitmaps.

Each single bitmap contains an ASCII code, and each one has the same height and width.

If a bitmap font contains 11 characters (0-9 and a space), the bitmaps are orderd in one line, therefore the size of the bitmap is exactly: 11*X_SIZE | Y_SIZE.
If a bitmap font contains 256 characters (all ASCII values), the bitmaps are orderd in 8 lines and 32 rows (resulting in the size of 32*X_SIZE | Y_SIZE*8).

When displaying e.g. the text "ABC" the engine checks the ASCII value of "A" (65) and then just displays the content of the 65 character in the bitmap font ==> (the one in the 3 line, 1 row (32+32+1)).

More: http://en.wikipedia.org/wiki/Computer_font (bitmap font)

Re: Bitmap Font Processing? [Re: TechMuc] #283725
08/09/09 16:22
08/09/09 16:22
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
hmmm ok thanks for the info. How can i tell the size of each individual character?

I know by looking at a (0-9) font, then each character is 1/11th the pixels of the width of the bitmap. But what about 32*4 or 32*8?

How can I automate the process.

Thanks.

Re: Bitmap Font Processing? [Re: DJBMASTER] #283726
08/09/09 17:00
08/09/09 17:00
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
1. ask jcl how they are distinguishing this in the engine
2. perform an aspect check. If the aspect appears to become nonsense, it's probably 32x8 instead of 32x4

Re: Bitmap Font Processing? [Re: FBL] #283804
08/10/09 08:00
08/10/09 08:00
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The mathematics should not require the IQ of a genius.

A row in a font bitmap contains either 11, or 32 characters. Thus, when the width is divisible by 11, then the character width is 1/11 the bitmap width. Otherwise it's 1/32 the bitmap width.

In the first case the character height is the same as the bitmap height, in the second case it's 1/4 or 1/8 the bitmap height, dependent on whether the bitmap width is more than 4 times its height, or not.

Re: Bitmap Font Processing? [Re: jcl] #289169
09/11/09 01:26
09/11/09 01:26
Joined: Oct 2003
Posts: 130
Wollongong Australia
J
Jethro Offline
Member
Jethro  Offline
Member
J

Joined: Oct 2003
Posts: 130
Wollongong Australia
OK, It's still a bit confusing.
When does your engine decide it has 4 rows of characters or 8 rows of characters.

Because the old c-script way my 128 character font of 448 * 112 Pixels.
ie. 14*28 per character, worked correctly, because you could specify width and height of chars.

Now with lite-c you can't specify width and heigth, and the above fon't doesn't display correctly anymore. I can only assume the engine thinks its an 8 row font now! Which it isn't.
To fix this I had to bring the aspect ratio up over 0.5
to 16*28 per character.

The documentation doesn't tell us how the engine decides what is 4 rows or 8 rows, and broke most of my fonts after converting to lite-c.

Please put this info in the manual, to prevent trial and error design in future.

Jethro.

Re: Bitmap Font Processing? [Re: Jethro] #289173
09/11/09 06:13
09/11/09 06:13
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
As I said: It's dependent on whether the bitmap width is more than 4 times its height, or not. This was added to the manual.


Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1