tsoding / olive.c

Simple 2D Graphics Library for C
https://tsoding.github.io/olive.c/
MIT License
1.86k stars 105 forks source link

font8x8 suggestion / request #14

Open benstigsen opened 1 year ago

benstigsen commented 1 year ago

The in-built font could become about 1/8th the size, by using a system like font8x8 does.

Instead of having a font that looks like so:

0, 0, 0, 1, 1, 0, 0, 0
0, 0, 1, 0, 0, 1, 0, 0
0, 0, 1, 0, 0, 1, 0, 0
0, 0, 1, 1, 1, 1, 0, 0
0, 0, 1, 0, 0, 1, 0, 0
0, 0, 1, 0, 0, 1, 0, 0
0, 0, 1, 0, 0, 1, 0, 0
0, 0, 1, 0, 0, 1, 0, 0

It could look like so:

0b00011000,
0b00100100,
0b00100100,
0b00111100,
0b00100100,
0b00100100,
0b00100100,
0b00100100,

Only being 8 bytes instead of 64.

I've used this system myself and it works really well for having small fonts, which are still easy to process, since it only requires a little amount of bitshifting. I have my own function from a little engine, which draws some multiline text, while using 8x8 bitfonts.