PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Simple bitmap font query

I am wondering how to create a bitmapped font.

It is obvious that you scan all pixels until they are not all background colour, then use that as the value in m_font.pOffset.

It is also obvious you then can extract the width of the char the same way, and the use of the little line at the top gives you your kerning.

But how do you define a space character?

does space have to be the first char in the mapping table ?

or do you just need a single line of background colour, and GapiDraw tests the char in the mapping table to see if it is a space char?

In simple fonts, how wide is a space char?

...
does space have to be the first char in the mapping table ?


No, you can define it anywhere in pString when you execute the CreateFont method.

In simple fonts, how wide is a space char?


If you use kerning marks, the space is the width of the kerning mark. If you don't use kerning marks, the space is how ever many blank pixels (blank being the background color) you use for it minus one since GapiDraw looks for at minimum one pixel between characters. It would be minus two pixels if the space character wasn't the first character in the font (eg it had another character before and after it). I believe this is correct, but Johan can verify this.

The best advice is to use kerning marks to eliminate any guess work.
does space have to be the first char in the mapping table ?


Actually, it does have to be first if you use the simple font format. If you define <space> as the first character in the string sent to CreateFont, the simple font format will use the number of empty pixels before the first character as space. :)

The best advice is to use kerning marks to eliminate any guess work.


Agreed.