LCD font generation with font examples

24×14 pixel ASCII font

This font can be easily used on graphics LCDs with horizontal size over 64 pixel. It have bold, clearly readable bold letters. Typical 160×32 pixel LCD can display up to 11 characters in single line, having still one line for standard 8×6 pixel font.

Bitmap is created and tweaked in graphics editor, using 24pt DejaVu Sans Monospace font as a base.

Font was generated in single 1485×24 pixel bitmap, rotated 90° CCW, inverted and saved as WBMP-file

Using WinHEX, C-code variable values dump was generated for simple library in C:

Source code file, C language with font bitmap
Source code file, C language header

**
  * Font table for 24x14 pixel characters
  */
#include "font_2414.h"

const unsigned char font_2414_b[4455] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	...
        ...
	0x0E, 0x0C, 0x06, 0x04, 0x0C, 0x06, 0x00, 0x0C, 0x06, 0x00, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

This font can be used by simple function, such as:

void draw_char_2414(uint8_t id, uint8_t x) {
    uint16_t i;
    id = id - 32;   // Bitmap don't have first 32 symbols, so we skip their ID.

    lcd_set_line(0, COL0 + x*FONT_2414_HZ); // Draw first line (top 8 bits)
    for (i = id*FONT_2414_HZ ; i < FONT_2414_HZ*id+FONT_2414_HZ; i++) {
        lcd_draw( font_2414_b[i*3+2] );
    }
    lcd_set_line(1, COL0 + x*FONT_2414_HZ); // Draw second line (middle 8 bits)
    for (i = id*FONT_2414_HZ ; i < FONT_2414_HZ*id+FONT_2414_HZ ; i++) {
        lcd_draw( font_2414_b[i*3+1] );
    }
    lcd_set_line(2, COL0 + x*FONT_2414_HZ); // Draw third line (bottom 8 bits)
    for (i = id*FONT_2414_HZ ; i < FONT_2414_HZ*id+FONT_2414_HZ ; i++) {
        lcd_draw( font_2414_b[i*3] );
    }
}

Example output on negative LCD screen can look like this:

Wrap function such as below can be used to take input string and output char’s:

void lcd_print_big(char* str, uint8_t x) {
    uint8_t ch, i;
    uint8_t xcnt = x;

    while (*str != 0) {
      ch = *str;
      draw_char_2414(ch, xcnt);
      xcnt++;
      str++;
    }
}

It’s used in example below:

sprintf(string,"%2.5f \x81\x7F", val);
sprintf(strx,"24x16 font test");
lcd_print_big((uint8_t *)string, 0);
lcd_print((uint8_t *)strx, 0, 3);

LCD photo:

VFD photo (256×64 graphics):

This font also have special characters:

Char position number Symbol
128 (/x7E) ~
129 (/x7F) 4W symbol
130 (/x80) °
131 (/x81) Ω
132 (/x82)
133 (/x83) α
134 (/x84) β
135 (/x85)
136 (/x86) ½
137 (/x87) ¾
138 (/x88) Σ

Also for mirrored addressing here are vertically flipped bitmap and Source code file

SEP.2022 Update:

Tom Collins reused and slightly modified bitmap above for his LCD application. His GitHub repostory also included additional Python script used to convert the .bmp file to a .fnt file for use by 4D Systems’s Workshop4 IDE.

Author: Ilya Tsemenko
Created: Jan. 15, 2016, 6:11 a.m.
Modified: Sept. 8, 2022, 12:45 a.m.

References