display_ssd1306.c: support monospaced fonts.

Monospaced fonts require a bit less space, right now it saves a
nice 110 bytes binary size.

Actually, the distinction between monospaced and proportional
fonts was in font.h already, so not supporting them was a bug.
But so far we have no monospaced font, so nobody noticed.
This commit is contained in:
Markus Hitter 2016-04-24 23:50:56 +02:00
parent 455b07eb6e
commit 9dd53a1722
1 changed files with 6 additions and 2 deletions

View File

@ -97,8 +97,12 @@ void display_text_P(uint8_t line, uint8_t column, PGM_P message) {
index -= 0x20;
// Send the character bitmap.
for (i = 0; i < pgm_read_byte(&font[index].columns); i++) {
displaybus_write(pgm_read_byte(&font[index].data[i]), 0);
#ifdef FONT_IS_PROPORTIONAL
for (i = 0; i < pgm_read_byte(&font[index].columns); i++) {
#else
for (i = 0; i < FONT_COLUMNS; i++) {
#endif
displaybus_write(pgm_read_byte(&font[index].data[i]), 0);
}
// Send space between characters.
for (i = 0; i < FONT_SYMBOL_SPACE; i++) {