Skip to content

Instantly share code, notes, and snippets.

@smcl
Created May 17, 2017 16:15
Show Gist options
  • Save smcl/cc349edbd371e353f2f1fc66cf7dab42 to your computer and use it in GitHub Desktop.
Save smcl/cc349edbd371e353f2f1fc66cf7dab42 to your computer and use it in GitHub Desktop.
// Slightly updated 5x7 font for ISO8859-2
#ifndef FONT5X7_H
#define FONT5X7_H
#ifdef __AVR__
#include <avr/io.h>
#include <avr/pgmspace.h>
#elif defined(ESP8266)
#include <pgmspace.h>
#else
#define PROGMEM
#endif
// Standard ASCII 5x7 font
static const unsigned char font[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
0x18, 0x3C, 0x7E, 0x3C, 0x18,
0x1C, 0x57, 0x7D, 0x57, 0x1C,
0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
0x00, 0x18, 0x3C, 0x18, 0x00,
0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
0x00, 0x18, 0x24, 0x18, 0x00,
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
0x30, 0x48, 0x3A, 0x06, 0x0E,
0x26, 0x29, 0x79, 0x29, 0x26,
0x40, 0x7F, 0x05, 0x05, 0x07,
0x40, 0x7F, 0x05, 0x25, 0x3F,
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
0x14, 0x22, 0x7F, 0x22, 0x14,
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
0x06, 0x09, 0x7F, 0x01, 0x7F,
0x00, 0x66, 0x89, 0x95, 0x6A,
0x60, 0x60, 0x60, 0x60, 0x60,
0x94, 0xA2, 0xFF, 0xA2, 0x94,
0x08, 0x04, 0x7E, 0x04, 0x08,
0x10, 0x20, 0x7E, 0x20, 0x10,
0x08, 0x08, 0x2A, 0x1C, 0x08,
0x08, 0x1C, 0x2A, 0x08, 0x08,
0x1E, 0x10, 0x10, 0x10, 0x10,
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
0x30, 0x38, 0x3E, 0x38, 0x30,
0x06, 0x0E, 0x3E, 0x0E, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14,
0x24, 0x2A, 0x7F, 0x2A, 0x12,
0x23, 0x13, 0x08, 0x64, 0x62,
0x36, 0x49, 0x56, 0x20, 0x50,
0x00, 0x08, 0x07, 0x03, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00,
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x80, 0x70, 0x30, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x60, 0x60, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02,
0x3E, 0x51, 0x49, 0x45, 0x3E,
0x00, 0x42, 0x7F, 0x40, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46,
0x21, 0x41, 0x49, 0x4D, 0x33,
0x18, 0x14, 0x12, 0x7F, 0x10,
0x27, 0x45, 0x45, 0x45, 0x39,
0x3C, 0x4A, 0x49, 0x49, 0x31,
0x41, 0x21, 0x11, 0x09, 0x07,
0x36, 0x49, 0x49, 0x49, 0x36,
0x46, 0x49, 0x49, 0x29, 0x1E,
0x00, 0x00, 0x14, 0x00, 0x00,
0x00, 0x40, 0x34, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41,
0x14, 0x14, 0x14, 0x14, 0x14,
0x00, 0x41, 0x22, 0x14, 0x08,
0x02, 0x01, 0x59, 0x09, 0x06,
0x3E, 0x41, 0x5D, 0x59, 0x4E,
0x7C, 0x12, 0x11, 0x12, 0x7C,
0x7F, 0x49, 0x49, 0x49, 0x36,
0x3E, 0x41, 0x41, 0x41, 0x22,
0x7F, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x49, 0x49, 0x49, 0x41,
0x7F, 0x09, 0x09, 0x09, 0x01,
0x3E, 0x41, 0x41, 0x51, 0x73,
0x7F, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x41, 0x7F, 0x41, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01,
0x7F, 0x08, 0x14, 0x22, 0x41,
0x7F, 0x40, 0x40, 0x40, 0x40,
0x7F, 0x02, 0x1C, 0x02, 0x7F,
0x7F, 0x04, 0x08, 0x10, 0x7F,
0x3E, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x09, 0x09, 0x09, 0x06,
0x3E, 0x41, 0x51, 0x21, 0x5E,
0x7F, 0x09, 0x19, 0x29, 0x46,
0x26, 0x49, 0x49, 0x49, 0x32,
0x03, 0x01, 0x7F, 0x01, 0x03,
0x3F, 0x40, 0x40, 0x40, 0x3F,
0x1F, 0x20, 0x40, 0x20, 0x1F,
0x3F, 0x40, 0x38, 0x40, 0x3F,
0x63, 0x14, 0x08, 0x14, 0x63,
0x03, 0x04, 0x78, 0x04, 0x03,
0x61, 0x59, 0x49, 0x4D, 0x43,
0x00, 0x7F, 0x41, 0x41, 0x41,
0x02, 0x04, 0x08, 0x10, 0x20,
0x00, 0x41, 0x41, 0x41, 0x7F,
0x04, 0x02, 0x01, 0x02, 0x04,
0x40, 0x40, 0x40, 0x40, 0x40,
0x00, 0x03, 0x07, 0x08, 0x00,
0x20, 0x54, 0x54, 0x78, 0x40,
0x7F, 0x28, 0x44, 0x44, 0x38,
0x38, 0x44, 0x44, 0x44, 0x28,
0x38, 0x44, 0x44, 0x28, 0x7F,
0x38, 0x54, 0x54, 0x54, 0x18,
0x00, 0x08, 0x7E, 0x09, 0x02,
0x18, 0xA4, 0xA4, 0x9C, 0x78,
0x7F, 0x08, 0x04, 0x04, 0x78,
0x00, 0x44, 0x7D, 0x40, 0x00,
0x20, 0x40, 0x40, 0x3D, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78,
0x7C, 0x08, 0x04, 0x04, 0x78,
0x38, 0x44, 0x44, 0x44, 0x38,
0xFC, 0x18, 0x24, 0x24, 0x18,
0x18, 0x24, 0x24, 0x18, 0xFC,
0x7C, 0x08, 0x04, 0x04, 0x08,
0x48, 0x54, 0x54, 0x54, 0x24,
0x04, 0x04, 0x3F, 0x44, 0x24,
0x3C, 0x40, 0x40, 0x20, 0x7C,
0x1C, 0x20, 0x40, 0x20, 0x1C,
0x3C, 0x40, 0x30, 0x40, 0x3C,
0x44, 0x28, 0x10, 0x28, 0x44,
0x4C, 0x90, 0x90, 0x90, 0x7C,
0x44, 0x64, 0x54, 0x4C, 0x44,
0x00, 0x08, 0x36, 0x41, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00,
0x02, 0x01, 0x02, 0x04, 0x02,
0x3C, 0x26, 0x23, 0x26, 0x3C,
0x1E, 0xA1, 0xA1, 0x61, 0x12, //////////////////////////////////////
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x81
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x82
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x83
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x84
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x85
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x86
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x87
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x88
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x89
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x8a
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x8b
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x8c
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x8d
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x8e
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x8f
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x90
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x91
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x92
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x93
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x94
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x95
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x96
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x97
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x98
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x99
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x9a
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x9b
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x9c
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x9d
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x9e
0xFF, 0x81, 0x01, 0x81, 0xFF, // 0x9f
0x00, 0x00, 0x00, 0x00, 0x00, // 0xa0
0x78, 0x14, 0x54, 0x94, 0x78, // 0xa1
0x01, 0x02, 0x02, 0x02, 0x01, // 0xa2
0x10, 0x7F, 0x48, 0x44, 0x40, // 0xa3
0x42, 0x3C, 0x24, 0x3C, 0x42, // 0xa4
0x7C, 0x41, 0x42, 0x40, 0x40, // 0xa5
0x48, 0x54, 0x56, 0x55, 0x34, // 0xa6
0x4A, 0x55, 0x55, 0x55, 0x29, // 0xa7
0x00, 0x01, 0x00, 0x01, 0x00, // 0xa8
0x48, 0x55, 0x56, 0x55, 0x34, // 0xa9
0x48, 0xD4, 0xD4, 0x54, 0x34, // 0xaa
0x04, 0x05, 0x7E, 0x05, 0x04, // 0xab
0x64, 0x54, 0x56, 0x55, 0x4C, // 0xac
0x10, 0x10, 0x10, 0x10, 0x10, // 0xad
0x64, 0x55, 0x56, 0x55, 0x4C, // 0xae
0x64, 0x54, 0x55, 0x54, 0x4C, // 0xaf
0x00, 0x00, 0x00, 0x00, 0x00, // some sort of buffer?
0x00, 0x02, 0x05, 0x02, 0x00, // 0xb0
0x20, 0x54, 0xD4, 0xF8, 0x40, // 0xb1
0x00, 0x00, 0x40, 0x80, 0x00, // 0xb2
0x00, 0x52, 0x7E, 0x48, 0x00, // 0xb3
0x00, 0x00, 0x02, 0x01, 0x00, // 0xb4
0x00, 0x44, 0x7C, 0x41, 0x02, // 0xb5
0x00, 0x50, 0x7A, 0x29, 0x00, // 0xb6
0x00, 0x01, 0x02, 0x01, 0x00, // 0xb7
0x00, 0x00, 0x80, 0x40, 0x00, // 0xb8
0x00, 0x51, 0x7A, 0x29, 0x00, // 0xb9
0x00, 0x50, 0xF8, 0x28, 0x00, // 0xba
0x00, 0x08, 0x3C, 0x49, 0x22, // 0xbb
0x00, 0x68, 0x7A, 0x59, 0x00, // 0xbc
0x00, 0x02, 0x01, 0x02, 0x01, // 0xbd
0x00, 0x69, 0x7A, 0x59, 0x00, // 0xbe
0x00, 0x68, 0x7A, 0x58, 0x00, // 0xbf
0x7C, 0x14, 0x16, 0x15, 0x68, // 0xc0
0x78, 0x14, 0x16, 0x15, 0x78, // 0xc1
0x78, 0x16, 0x15, 0x16, 0x78, // 0xc2
0x79, 0x16, 0x16, 0x16, 0x79, // 0xc3
0x78, 0x15, 0x14, 0x15, 0x78, // 0xc4
0x7C, 0x40, 0x42, 0x41, 0x40, // 0xc5
0x38, 0x44, 0x46, 0x45, 0x44, // 0xc6
0x38, 0xC4, 0x44, 0x44, 0x44, // 0xc7
0x38, 0x45, 0x46, 0x45, 0x44, // 0xc8
0x7C, 0x54, 0x56, 0x55, 0x44, // 0xc9
0x7C, 0x54, 0xD4, 0x54, 0x44, // 0xca
0x7C, 0x55, 0x54, 0x55, 0x44, // 0xcb
0x7C, 0x55, 0x56, 0x55, 0x44, // 0xcc
0x00, 0x44, 0x7E, 0x45, 0x00, // 0xcd
0x00, 0x46, 0x7D, 0x46, 0x00, // 0xce
0x7C, 0x45, 0x46, 0x45, 0x38, // 0xcf
0x10, 0x7C, 0x54, 0x44, 0x38, // 0xd0
0x7C, 0x08, 0x12, 0x21, 0x7C, // 0xd1
0x7C, 0x09, 0x12, 0x21, 0x7C, // 0xd2
0x38, 0x44, 0x46, 0x45, 0x38, // 0xd3
0x38, 0x46, 0x45, 0x46, 0x38, // 0xd4
0x38, 0x46, 0x45, 0x46, 0x39, // 0xd5
0x38, 0x45, 0x44, 0x45, 0x38, // 0xd6
0x44, 0x28, 0x10, 0x28, 0x44, // 0xd7
0x7C, 0x15, 0x16, 0x15, 0x68, // 0xd8
0x3C, 0x40, 0x42, 0x40, 0x3C, // 0xd9
0x3C, 0x40, 0x42, 0x41, 0x3C, // 0xda
0x3C, 0x42, 0x41, 0x42, 0x3D, // 0xdb
0x3C, 0x41, 0x40, 0x41, 0x3C, // 0xdc
0x04, 0x08, 0x72, 0x09, 0x04, // 0xdd
0x00, 0x44, 0x3C, 0x04, 0x00, // 0xde
0xFE, 0x49, 0x89, 0x96, 0x60, // 0xdf
0x78, 0x10, 0x0A, 0x09, 0x10, // 0xe0
0x20, 0x54, 0x56, 0x79, 0x40, // 0xe1
0x20, 0x56, 0x55, 0x7A, 0x40, // 0xe2
0x21, 0x56, 0x56, 0x7A, 0x41, // 0xe3
0x20, 0x55, 0x54, 0x79, 0x40, // 0xe5
0x02, 0x45, 0x7C, 0x40, 0x00, // 0xe5
0x30, 0x48, 0x4A, 0x49, 0x48, // 0xe6
0x30, 0xC8, 0x48, 0x48, 0x48, // 0xe7
0x30, 0x49, 0x4A, 0x49, 0x48, // 0xe8
0x38, 0x54, 0x56, 0x55, 0x08, // 0xe9
0x38, 0x54, 0xD4, 0x54, 0x08, // 0xea
0x38, 0x55, 0x54, 0x55, 0x08, // 0xeb
0x38, 0x55, 0x56, 0x55, 0x08, // 0xec
0x00, 0x40, 0x7A, 0x41, 0x00, // 0xed
0x00, 0x42, 0x79, 0x42, 0x00, // 0xee
0x20, 0x70, 0x50, 0x7D, 0x02, // 0xef
0x20, 0x70, 0x54, 0x7E, 0x04, // 0xf0
0x78, 0x10, 0x0A, 0x09, 0x70, // 0xf1
0x78, 0x11, 0x0A, 0x09, 0x70, // 0xf2
0x30, 0x48, 0x4A, 0x49, 0x30, // 0xf3
0x30, 0x4A, 0x49, 0x4A, 0x30, // 0xf4
0x30, 0x4A, 0x49, 0x4A, 0x31, // 0xf5
0x30, 0x49, 0x48, 0x49, 0x30, // 0xf6
0x00, 0x10, 0x54, 0x10, 0x00, // 0xf7
0x78, 0x11, 0x0A, 0x09, 0x10, // 0xf8
0x38, 0x40, 0x42, 0x20, 0x78, // 0xf9
0x38, 0x40, 0x42, 0x21, 0x78, // 0xfa
0x38, 0x42, 0x41, 0x22, 0x79, // 0xfb
0x38, 0x41, 0x40, 0x21, 0x78, // 0xfc
0x18, 0xA0, 0xA2, 0xA1, 0x78, // 0xfd
0x00, 0x08, 0xFC, 0x48, 0x00, // 0xfe
0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP
};
#endif // FONT5X7_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment