casnix wrote:And to print the character I would find the most significant bit and lowest significant bit and print the pixels with those?
To print a character, all you need to do is decode the pixels. Test every bit in a row, if you find a '1' this means you need to plot the pixel at current position(graph) and if you find a '0', you need to ignore this pixel and move a step forward to next position(graph). You need to continue like this until you decode every row of this character.
casnix wrote:Say I have an uppercase C:
Code: Select all
...XX...
..XXXX..
.XX..XX.
.XX.....
.XX.....
..XXXX..
...XX...
How would I store that in such a way that I can print it (in 320x200x16)?
To store this font you'd have store each
pixel bit by bit and each
row byte by byte. Meaning that your font should be stored like this:
Code: Select all
...XX... //00011000
..XXXX.. //00111100
.XX..XX. //01100110
.XX..... //01100000
.XX..... //01100000
..XXXX.. //00111100
...XX... //00011000
........ // 00000000
unsigned char C[8]={
0x18,0x3C,0x66,0x66,0x3C,0x18,0x00
};
In this case, each row is stored in a byte, meaning that 0x18 stores pixels of the first row and 0x00 stores pixels of the last row.
And of course, you wouldn't want to store individual characters like I did(
unsigned char C[8]) and probably want to store every characters in a font table. This is a piece of a cake, once you understand the encoding and decoding process.
And oh yes, this way of storing fonts is traditional and comes with limitations. You may want to adopt a new way of storing fonts, once you're done with this. I've my own implementation, if any one is interested.............
Best Regards,
Chandra