diff options
-rw-r--r-- | include/lib/pixelfont/terminus16.h | 385 | ||||
-rwxr-xr-x | include/lib/pixelfont/ttf-to-font.py | 18 | ||||
-rw-r--r-- | include/object/framebuffer.h | 5 | ||||
-rw-r--r-- | src/os/object/framebuffer.cc | 28 |
4 files changed, 229 insertions, 207 deletions
diff --git a/include/lib/pixelfont/terminus16.h b/include/lib/pixelfont/terminus16.h index 0f1a581..e63fba8 100644 --- a/include/lib/pixelfont/terminus16.h +++ b/include/lib/pixelfont/terminus16.h @@ -14,196 +14,201 @@ #else #define GLYPH_ATTR #endif -glyph_line_t GLYPH_ATTR chr_032[] = {0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; // <spac> -glyph_line_t GLYPH_ATTR chr_033[] = {0x1b,0xf8}; // ! -glyph_line_t GLYPH_ATTR chr_034[] = {0x00,0x1c,0x00,0x00,0x00,0x00,0x00,0x1c}; // " -glyph_line_t GLYPH_ATTR chr_035[] = {0x02,0x40,0x1f,0xf8,0x02,0x40,0x02,0x40,0x1f,0xf8,0x02,0x40}; // # -glyph_line_t GLYPH_ATTR chr_036[] = {0x08,0xe0,0x11,0x10,0x11,0x10,0x7f,0xfc,0x11,0x10,0x11,0x10,0x0e,0x20}; // $ -glyph_line_t GLYPH_ATTR chr_037[] = {0x00,0x10,0x18,0x28,0x06,0x28,0x09,0x90,0x14,0x60,0x14,0x18,0x08,0x00}; // % -glyph_line_t GLYPH_ATTR chr_038[] = {0x0f,0x00,0x10,0xb0,0x10,0xc8,0x11,0x48,0x0e,0x30,0x11,0x00}; // & -glyph_line_t GLYPH_ATTR chr_039[] = {0x00,0x1c}; // ' -glyph_line_t GLYPH_ATTR chr_040[] = {0x07,0xe0,0x08,0x10,0x10,0x08}; // ( -glyph_line_t GLYPH_ATTR chr_041[] = {0x10,0x08,0x08,0x10,0x07,0xe0}; // ) -glyph_line_t GLYPH_ATTR chr_042[] = {0x01,0x00,0x05,0x40,0x03,0x80,0x03,0x80,0x05,0x40,0x01,0x00}; // * -glyph_line_t GLYPH_ATTR chr_043[] = {0x01,0x00,0x01,0x00,0x07,0xc0,0x01,0x00,0x01,0x00}; // + -glyph_line_t GLYPH_ATTR chr_044[] = {0x20,0x00,0x18,0x00}; // , -glyph_line_t GLYPH_ATTR chr_045[] = {0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00}; // - -glyph_line_t GLYPH_ATTR chr_046[] = {0x18,0x00}; // . -glyph_line_t GLYPH_ATTR chr_047[] = {0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x60,0x00,0x18}; // / -glyph_line_t GLYPH_ATTR chr_048[] = {0x0f,0xf0,0x12,0x08,0x11,0x08,0x10,0x88,0x10,0x48,0x0f,0xf0}; // 0 -glyph_line_t GLYPH_ATTR chr_049[] = {0x10,0x20,0x10,0x10,0x1f,0xf8,0x10,0x00,0x10,0x00}; // 1 -glyph_line_t GLYPH_ATTR chr_050[] = {0x18,0x30,0x14,0x08,0x12,0x08,0x11,0x08,0x10,0x88,0x10,0x70}; // 2 -glyph_line_t GLYPH_ATTR chr_051[] = {0x0c,0x30,0x10,0x08,0x10,0x88,0x10,0x88,0x10,0x88,0x0f,0x70}; // 3 -glyph_line_t GLYPH_ATTR chr_052[] = {0x03,0x00,0x02,0x80,0x02,0x40,0x02,0x20,0x02,0x10,0x1f,0xf8}; // 4 -glyph_line_t GLYPH_ATTR chr_053[] = {0x08,0xf8,0x10,0x88,0x10,0x88,0x10,0x88,0x10,0x88,0x0f,0x08}; // 5 -glyph_line_t GLYPH_ATTR chr_054[] = {0x0f,0xe0,0x10,0x90,0x10,0x88,0x10,0x88,0x10,0x88,0x0f,0x00}; // 6 -glyph_line_t GLYPH_ATTR chr_055[] = {0x00,0x08,0x00,0x08,0x1c,0x08,0x03,0x08,0x00,0xc8,0x00,0x38}; // 7 -glyph_line_t GLYPH_ATTR chr_056[] = {0x0f,0x70,0x10,0x88,0x10,0x88,0x10,0x88,0x10,0x88,0x0f,0x70}; // 8 -glyph_line_t GLYPH_ATTR chr_057[] = {0x00,0xf0,0x11,0x08,0x11,0x08,0x11,0x08,0x09,0x08,0x07,0xf0}; // 9 -glyph_line_t GLYPH_ATTR chr_058[] = {0x18,0xc0}; // : -glyph_line_t GLYPH_ATTR chr_059[] = {0x20,0x00,0x18,0xc0}; // ; -glyph_line_t GLYPH_ATTR chr_060[] = {0x01,0x00,0x02,0x80,0x04,0x40,0x08,0x20,0x10,0x10}; // < -glyph_line_t GLYPH_ATTR chr_061[] = {0x02,0x40,0x02,0x40,0x02,0x40,0x02,0x40,0x02,0x40,0x02,0x40}; // = -glyph_line_t GLYPH_ATTR chr_062[] = {0x10,0x10,0x08,0x20,0x04,0x40,0x02,0x80,0x01,0x00}; // > -glyph_line_t GLYPH_ATTR chr_063[] = {0x00,0x70,0x00,0x08,0x00,0x08,0x1b,0x08,0x00,0x88,0x00,0x70}; // ? -glyph_line_t GLYPH_ATTR chr_064[] = {0x0f,0xf0,0x10,0x08,0x13,0xc8,0x14,0x28,0x14,0x28,0x12,0x28,0x17,0xf0}; // @ -glyph_line_t GLYPH_ATTR chr_065[] = {0x1f,0xf0,0x01,0x08,0x01,0x08,0x01,0x08,0x01,0x08,0x1f,0xf0}; // A -glyph_line_t GLYPH_ATTR chr_066[] = {0x1f,0xf8,0x10,0x88,0x10,0x88,0x10,0x88,0x10,0x88,0x0f,0x70}; // B -glyph_line_t GLYPH_ATTR chr_067[] = {0x0f,0xf0,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x0c,0x30}; // C -glyph_line_t GLYPH_ATTR chr_068[] = {0x1f,0xf8,0x10,0x08,0x10,0x08,0x10,0x08,0x08,0x10,0x07,0xe0}; // D -glyph_line_t GLYPH_ATTR chr_069[] = {0x1f,0xf8,0x10,0x88,0x10,0x88,0x10,0x88,0x10,0x08,0x10,0x08}; // E -glyph_line_t GLYPH_ATTR chr_070[] = {0x1f,0xf8,0x00,0x88,0x00,0x88,0x00,0x88,0x00,0x08,0x00,0x08}; // F -glyph_line_t GLYPH_ATTR chr_071[] = {0x0f,0xf0,0x10,0x08,0x10,0x08,0x11,0x08,0x11,0x08,0x0f,0x30}; // G -glyph_line_t GLYPH_ATTR chr_072[] = {0x1f,0xf8,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x1f,0xf8}; // H -glyph_line_t GLYPH_ATTR chr_073[] = {0x10,0x08,0x1f,0xf8,0x10,0x08}; // I -glyph_line_t GLYPH_ATTR chr_074[] = {0x0c,0x00,0x10,0x00,0x10,0x00,0x10,0x08,0x0f,0xf8,0x00,0x08}; // J -glyph_line_t GLYPH_ATTR chr_075[] = {0x1f,0xf8,0x01,0x80,0x02,0x40,0x04,0x20,0x08,0x10,0x10,0x08}; // K -glyph_line_t GLYPH_ATTR chr_076[] = {0x1f,0xf8,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00}; // L -glyph_line_t GLYPH_ATTR chr_077[] = {0x1f,0xf8,0x00,0x10,0x00,0x20,0x00,0xc0,0x00,0x20,0x00,0x10,0x1f,0xf8}; // M -glyph_line_t GLYPH_ATTR chr_078[] = {0x1f,0xf8,0x00,0x40,0x00,0x80,0x01,0x00,0x02,0x00,0x1f,0xf8}; // N -glyph_line_t GLYPH_ATTR chr_079[] = {0x0f,0xf0,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x0f,0xf0}; // O -glyph_line_t GLYPH_ATTR chr_080[] = {0x1f,0xf8,0x01,0x08,0x01,0x08,0x01,0x08,0x01,0x08,0x00,0xf0}; // P -glyph_line_t GLYPH_ATTR chr_081[] = {0x0f,0xf0,0x10,0x08,0x10,0x08,0x18,0x08,0x10,0x08,0x2f,0xf0}; // Q -glyph_line_t GLYPH_ATTR chr_082[] = {0x1f,0xf8,0x01,0x08,0x03,0x08,0x05,0x08,0x09,0x08,0x10,0xf0}; // R -glyph_line_t GLYPH_ATTR chr_083[] = {0x0c,0x70,0x10,0x88,0x10,0x88,0x10,0x88,0x10,0x88,0x0f,0x10}; // S -glyph_line_t GLYPH_ATTR chr_084[] = {0x00,0x08,0x00,0x08,0x00,0x08,0x1f,0xf8,0x00,0x08,0x00,0x08,0x00,0x08}; // T -glyph_line_t GLYPH_ATTR chr_085[] = {0x0f,0xf8,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x0f,0xf8}; // U -glyph_line_t GLYPH_ATTR chr_086[] = {0x00,0xf8,0x07,0x00,0x18,0x00,0x18,0x00,0x07,0x00,0x00,0xf8}; // V -glyph_line_t GLYPH_ATTR chr_087[] = {0x1f,0xf8,0x08,0x00,0x04,0x00,0x03,0x00,0x04,0x00,0x08,0x00,0x1f,0xf8}; // W -glyph_line_t GLYPH_ATTR chr_088[] = {0x18,0x18,0x06,0x60,0x01,0x80,0x01,0x80,0x06,0x60,0x18,0x18}; // X -glyph_line_t GLYPH_ATTR chr_089[] = {0x00,0x18,0x00,0x60,0x00,0x80,0x1f,0x00,0x00,0x80,0x00,0x60,0x00,0x18}; // Y -glyph_line_t GLYPH_ATTR chr_090[] = {0x1c,0x08,0x12,0x08,0x11,0x08,0x10,0x88,0x10,0x48,0x10,0x38}; // Z -glyph_line_t GLYPH_ATTR chr_091[] = {0x1f,0xf8,0x10,0x08,0x10,0x08}; // [ -glyph_line_t GLYPH_ATTR chr_092[] = {0x00,0x18,0x00,0x60,0x01,0x80,0x06,0x00,0x18,0x00}; // \ -glyph_line_t GLYPH_ATTR chr_093[] = {0x10,0x08,0x10,0x08,0x1f,0xf8}; // ] -glyph_line_t GLYPH_ATTR chr_094[] = {0x00,0x10,0x00,0x08,0x00,0x04,0x00,0x08,0x00,0x10}; // ^ -glyph_line_t GLYPH_ATTR chr_095[] = {0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00}; // _ -glyph_line_t GLYPH_ATTR chr_096[] = {0x00,0x02,0x00,0x04}; // ` -glyph_line_t GLYPH_ATTR chr_097[] = {0x0e,0x00,0x11,0x40,0x11,0x40,0x11,0x40,0x11,0x40,0x1f,0x80}; // a -glyph_line_t GLYPH_ATTR chr_098[] = {0x1f,0xf8,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x0f,0x80}; // b -glyph_line_t GLYPH_ATTR chr_099[] = {0x0f,0x80,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x08,0x80}; // c -glyph_line_t GLYPH_ATTR chr_100[] = {0x0f,0x80,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x1f,0xf8}; // d -glyph_line_t GLYPH_ATTR chr_101[] = {0x0f,0x80,0x12,0x40,0x12,0x40,0x12,0x40,0x12,0x40,0x03,0x80}; // e -glyph_line_t GLYPH_ATTR chr_102[] = {0x00,0x40,0x00,0x40,0x1f,0xf0,0x00,0x48,0x00,0x48,0x00,0x08}; // f -glyph_line_t GLYPH_ATTR chr_103[] = {0x0f,0x80,0x50,0x40,0x50,0x40,0x50,0x40,0x50,0x40,0x3f,0xc0}; // g -glyph_line_t GLYPH_ATTR chr_104[] = {0x1f,0xf8,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x1f,0x80}; // h -glyph_line_t GLYPH_ATTR chr_105[] = {0x10,0x40,0x1f,0xd8,0x10,0x00}; // i -glyph_line_t GLYPH_ATTR chr_106[] = {0x30,0x00,0x40,0x00,0x40,0x00,0x40,0x40,0x3f,0xd8}; // j -glyph_line_t GLYPH_ATTR chr_107[] = {0x1f,0xf8,0x02,0x00,0x02,0x00,0x05,0x00,0x08,0x80,0x10,0x40}; // k -glyph_line_t GLYPH_ATTR chr_108[] = {0x10,0x08,0x1f,0xf8,0x10,0x00}; // l -glyph_line_t GLYPH_ATTR chr_109[] = {0x1f,0xc0,0x00,0x40,0x00,0x40,0x1f,0xc0,0x00,0x40,0x00,0x40,0x1f,0x80}; // m -glyph_line_t GLYPH_ATTR chr_110[] = {0x1f,0xc0,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x1f,0x80}; // n -glyph_line_t GLYPH_ATTR chr_111[] = {0x0f,0x80,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x0f,0x80}; // o -glyph_line_t GLYPH_ATTR chr_112[] = {0x7f,0xc0,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x0f,0x80}; // p -glyph_line_t GLYPH_ATTR chr_113[] = {0x0f,0x80,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x7f,0xc0}; // q -glyph_line_t GLYPH_ATTR chr_114[] = {0x1f,0xc0,0x00,0x80,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40}; // r -glyph_line_t GLYPH_ATTR chr_115[] = {0x11,0x80,0x12,0x40,0x12,0x40,0x12,0x40,0x12,0x40,0x0c,0x40}; // s -glyph_line_t GLYPH_ATTR chr_116[] = {0x00,0x40,0x00,0x40,0x0f,0xf8,0x10,0x40,0x10,0x40,0x10,0x00}; // t -glyph_line_t GLYPH_ATTR chr_117[] = {0x0f,0xc0,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x1f,0xc0}; // u -glyph_line_t GLYPH_ATTR chr_118[] = {0x01,0xc0,0x06,0x00,0x18,0x00,0x18,0x00,0x06,0x00,0x01,0xc0}; // v -glyph_line_t GLYPH_ATTR chr_119[] = {0x0f,0xc0,0x10,0x00,0x10,0x00,0x1f,0x00,0x10,0x00,0x10,0x00,0x0f,0xc0}; // w -glyph_line_t GLYPH_ATTR chr_120[] = {0x18,0xc0,0x05,0x00,0x02,0x00,0x02,0x00,0x05,0x00,0x18,0xc0}; // x -glyph_line_t GLYPH_ATTR chr_121[] = {0x0f,0xc0,0x50,0x00,0x50,0x00,0x50,0x00,0x50,0x00,0x3f,0xc0}; // y -glyph_line_t GLYPH_ATTR chr_122[] = {0x18,0x40,0x14,0x40,0x12,0x40,0x11,0x40,0x10,0xc0,0x10,0x40}; // z -glyph_line_t GLYPH_ATTR chr_123[] = {0x00,0x80,0x0f,0x70,0x10,0x08,0x10,0x08}; // { -glyph_line_t GLYPH_ATTR chr_124[] = {0x1f,0xf8}; // | -glyph_line_t GLYPH_ATTR chr_125[] = {0x10,0x08,0x10,0x08,0x0f,0x70,0x00,0x80}; // } -glyph_line_t GLYPH_ATTR chr_126[] = {0x00,0x18,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x0c}; // ~ + +typedef const unsigned char glyph_line_t; +typedef const unsigned char* glyph_t; + +glyph_line_t GLYPH_ATTR chr16_032[] = {0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; // <spac> +glyph_line_t GLYPH_ATTR chr16_033[] = {0x02,0xfc,0x0d}; // ! +glyph_line_t GLYPH_ATTR chr16_034[] = {0x08,0x0e,0x00,0x00,0x00,0x00,0x00,0x0e,0x00}; // " +glyph_line_t GLYPH_ATTR chr16_035[] = {0x0c,0x20,0x01,0xfc,0x0f,0x20,0x01,0x20,0x01,0xfc,0x0f,0x20,0x01}; // # +glyph_line_t GLYPH_ATTR chr16_036[] = {0x0e,0x70,0x04,0x88,0x08,0x88,0x08,0xfe,0x3f,0x88,0x08,0x88,0x08,0x10,0x07}; // $ +glyph_line_t GLYPH_ATTR chr16_037[] = {0x0e,0x08,0x00,0x14,0x0c,0x14,0x03,0xc8,0x04,0x30,0x0a,0x0c,0x0a,0x00,0x04}; // % +glyph_line_t GLYPH_ATTR chr16_038[] = {0x0c,0x80,0x07,0x58,0x08,0x64,0x08,0xa4,0x08,0x18,0x07,0x80,0x08}; // & +glyph_line_t GLYPH_ATTR chr16_039[] = {0x02,0x0e,0x00}; // ' +glyph_line_t GLYPH_ATTR chr16_040[] = {0x06,0xf0,0x03,0x08,0x04,0x04,0x08}; // ( +glyph_line_t GLYPH_ATTR chr16_041[] = {0x06,0x04,0x08,0x08,0x04,0xf0,0x03}; // ) +glyph_line_t GLYPH_ATTR chr16_042[] = {0x0c,0x80,0x00,0xa0,0x02,0xc0,0x01,0xc0,0x01,0xa0,0x02,0x80,0x00}; // * +glyph_line_t GLYPH_ATTR chr16_043[] = {0x0a,0x80,0x00,0x80,0x00,0xe0,0x03,0x80,0x00,0x80,0x00}; // + +glyph_line_t GLYPH_ATTR chr16_044[] = {0x04,0x00,0x10,0x00,0x0c}; // , +glyph_line_t GLYPH_ATTR chr16_045[] = {0x0c,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00}; // - +glyph_line_t GLYPH_ATTR chr16_046[] = {0x02,0x00,0x0c}; // . +glyph_line_t GLYPH_ATTR chr16_047[] = {0x0a,0x00,0x0c,0x00,0x03,0xc0,0x00,0x30,0x00,0x0c,0x00}; // / +glyph_line_t GLYPH_ATTR chr16_048[] = {0x0c,0xf8,0x07,0x04,0x09,0x84,0x08,0x44,0x08,0x24,0x08,0xf8,0x07}; // 0 +glyph_line_t GLYPH_ATTR chr16_049[] = {0x0a,0x10,0x08,0x08,0x08,0xfc,0x0f,0x00,0x08,0x00,0x08}; // 1 +glyph_line_t GLYPH_ATTR chr16_050[] = {0x0c,0x18,0x0c,0x04,0x0a,0x04,0x09,0x84,0x08,0x44,0x08,0x38,0x08}; // 2 +glyph_line_t GLYPH_ATTR chr16_051[] = {0x0c,0x18,0x06,0x04,0x08,0x44,0x08,0x44,0x08,0x44,0x08,0xb8,0x07}; // 3 +glyph_line_t GLYPH_ATTR chr16_052[] = {0x0c,0x80,0x01,0x40,0x01,0x20,0x01,0x10,0x01,0x08,0x01,0xfc,0x0f}; // 4 +glyph_line_t GLYPH_ATTR chr16_053[] = {0x0c,0x7c,0x04,0x44,0x08,0x44,0x08,0x44,0x08,0x44,0x08,0x84,0x07}; // 5 +glyph_line_t GLYPH_ATTR chr16_054[] = {0x0c,0xf0,0x07,0x48,0x08,0x44,0x08,0x44,0x08,0x44,0x08,0x80,0x07}; // 6 +glyph_line_t GLYPH_ATTR chr16_055[] = {0x0c,0x04,0x00,0x04,0x00,0x04,0x0e,0x84,0x01,0x64,0x00,0x1c,0x00}; // 7 +glyph_line_t GLYPH_ATTR chr16_056[] = {0x0c,0xb8,0x07,0x44,0x08,0x44,0x08,0x44,0x08,0x44,0x08,0xb8,0x07}; // 8 +glyph_line_t GLYPH_ATTR chr16_057[] = {0x0c,0x78,0x00,0x84,0x08,0x84,0x08,0x84,0x08,0x84,0x04,0xf8,0x03}; // 9 +glyph_line_t GLYPH_ATTR chr16_058[] = {0x02,0x60,0x0c}; // : +glyph_line_t GLYPH_ATTR chr16_059[] = {0x04,0x00,0x10,0x60,0x0c}; // ; +glyph_line_t GLYPH_ATTR chr16_060[] = {0x0a,0x80,0x00,0x40,0x01,0x20,0x02,0x10,0x04,0x08,0x08}; // < +glyph_line_t GLYPH_ATTR chr16_061[] = {0x0c,0x20,0x01,0x20,0x01,0x20,0x01,0x20,0x01,0x20,0x01,0x20,0x01}; // = +glyph_line_t GLYPH_ATTR chr16_062[] = {0x0a,0x08,0x08,0x10,0x04,0x20,0x02,0x40,0x01,0x80,0x00}; // > +glyph_line_t GLYPH_ATTR chr16_063[] = {0x0c,0x38,0x00,0x04,0x00,0x04,0x00,0x84,0x0d,0x44,0x00,0x38,0x00}; // ? +glyph_line_t GLYPH_ATTR chr16_064[] = {0x0e,0xf8,0x07,0x04,0x08,0xe4,0x09,0x14,0x0a,0x14,0x0a,0x14,0x09,0xf8,0x0b}; // @ +glyph_line_t GLYPH_ATTR chr16_065[] = {0x0c,0xf8,0x0f,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0xf8,0x0f}; // A +glyph_line_t GLYPH_ATTR chr16_066[] = {0x0c,0xfc,0x0f,0x44,0x08,0x44,0x08,0x44,0x08,0x44,0x08,0xb8,0x07}; // B +glyph_line_t GLYPH_ATTR chr16_067[] = {0x0c,0xf8,0x07,0x04,0x08,0x04,0x08,0x04,0x08,0x04,0x08,0x18,0x06}; // C +glyph_line_t GLYPH_ATTR chr16_068[] = {0x0c,0xfc,0x0f,0x04,0x08,0x04,0x08,0x04,0x08,0x08,0x04,0xf0,0x03}; // D +glyph_line_t GLYPH_ATTR chr16_069[] = {0x0c,0xfc,0x0f,0x44,0x08,0x44,0x08,0x44,0x08,0x04,0x08,0x04,0x08}; // E +glyph_line_t GLYPH_ATTR chr16_070[] = {0x0c,0xfc,0x0f,0x44,0x00,0x44,0x00,0x44,0x00,0x04,0x00,0x04,0x00}; // F +glyph_line_t GLYPH_ATTR chr16_071[] = {0x0c,0xf8,0x07,0x04,0x08,0x04,0x08,0x84,0x08,0x84,0x08,0x98,0x07}; // G +glyph_line_t GLYPH_ATTR chr16_072[] = {0x0c,0xfc,0x0f,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0xfc,0x0f}; // H +glyph_line_t GLYPH_ATTR chr16_073[] = {0x06,0x04,0x08,0xfc,0x0f,0x04,0x08}; // I +glyph_line_t GLYPH_ATTR chr16_074[] = {0x0c,0x00,0x06,0x00,0x08,0x00,0x08,0x04,0x08,0xfc,0x07,0x04,0x00}; // J +glyph_line_t GLYPH_ATTR chr16_075[] = {0x0c,0xfc,0x0f,0xc0,0x00,0x20,0x01,0x10,0x02,0x08,0x04,0x04,0x08}; // K +glyph_line_t GLYPH_ATTR chr16_076[] = {0x0c,0xfc,0x0f,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08}; // L +glyph_line_t GLYPH_ATTR chr16_077[] = {0x0e,0xfc,0x0f,0x08,0x00,0x10,0x00,0x60,0x00,0x10,0x00,0x08,0x00,0xfc,0x0f}; // M +glyph_line_t GLYPH_ATTR chr16_078[] = {0x0c,0xfc,0x0f,0x20,0x00,0x40,0x00,0x80,0x00,0x00,0x01,0xfc,0x0f}; // N +glyph_line_t GLYPH_ATTR chr16_079[] = {0x0c,0xf8,0x07,0x04,0x08,0x04,0x08,0x04,0x08,0x04,0x08,0xf8,0x07}; // O +glyph_line_t GLYPH_ATTR chr16_080[] = {0x0c,0xfc,0x0f,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x78,0x00}; // P +glyph_line_t GLYPH_ATTR chr16_081[] = {0x0c,0xf8,0x07,0x04,0x08,0x04,0x08,0x04,0x0c,0x04,0x08,0xf8,0x17}; // Q +glyph_line_t GLYPH_ATTR chr16_082[] = {0x0c,0xfc,0x0f,0x84,0x00,0x84,0x01,0x84,0x02,0x84,0x04,0x78,0x08}; // R +glyph_line_t GLYPH_ATTR chr16_083[] = {0x0c,0x38,0x06,0x44,0x08,0x44,0x08,0x44,0x08,0x44,0x08,0x88,0x07}; // S +glyph_line_t GLYPH_ATTR chr16_084[] = {0x0e,0x04,0x00,0x04,0x00,0x04,0x00,0xfc,0x0f,0x04,0x00,0x04,0x00,0x04,0x00}; // T +glyph_line_t GLYPH_ATTR chr16_085[] = {0x0c,0xfc,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0xfc,0x07}; // U +glyph_line_t GLYPH_ATTR chr16_086[] = {0x0c,0x7c,0x00,0x80,0x03,0x00,0x0c,0x00,0x0c,0x80,0x03,0x7c,0x00}; // V +glyph_line_t GLYPH_ATTR chr16_087[] = {0x0e,0xfc,0x0f,0x00,0x04,0x00,0x02,0x80,0x01,0x00,0x02,0x00,0x04,0xfc,0x0f}; // W +glyph_line_t GLYPH_ATTR chr16_088[] = {0x0c,0x0c,0x0c,0x30,0x03,0xc0,0x00,0xc0,0x00,0x30,0x03,0x0c,0x0c}; // X +glyph_line_t GLYPH_ATTR chr16_089[] = {0x0e,0x0c,0x00,0x30,0x00,0x40,0x00,0x80,0x0f,0x40,0x00,0x30,0x00,0x0c,0x00}; // Y +glyph_line_t GLYPH_ATTR chr16_090[] = {0x0c,0x04,0x0e,0x04,0x09,0x84,0x08,0x44,0x08,0x24,0x08,0x1c,0x08}; // Z +glyph_line_t GLYPH_ATTR chr16_091[] = {0x06,0xfc,0x0f,0x04,0x08,0x04,0x08}; // [ +glyph_line_t GLYPH_ATTR chr16_092[] = {0x0a,0x0c,0x00,0x30,0x00,0xc0,0x00,0x00,0x03,0x00,0x0c}; // backslash +glyph_line_t GLYPH_ATTR chr16_093[] = {0x06,0x04,0x08,0x04,0x08,0xfc,0x0f}; // ] +glyph_line_t GLYPH_ATTR chr16_094[] = {0x0a,0x08,0x00,0x04,0x00,0x02,0x00,0x04,0x00,0x08,0x00}; // ^ +glyph_line_t GLYPH_ATTR chr16_095[] = {0x0c,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10}; // _ +glyph_line_t GLYPH_ATTR chr16_096[] = {0x04,0x01,0x00,0x02,0x00}; // ` +glyph_line_t GLYPH_ATTR chr16_097[] = {0x0c,0x00,0x07,0xa0,0x08,0xa0,0x08,0xa0,0x08,0xa0,0x08,0xc0,0x0f}; // a +glyph_line_t GLYPH_ATTR chr16_098[] = {0x0c,0xfc,0x0f,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0xc0,0x07}; // b +glyph_line_t GLYPH_ATTR chr16_099[] = {0x0c,0xc0,0x07,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x40,0x04}; // c +glyph_line_t GLYPH_ATTR chr16_100[] = {0x0c,0xc0,0x07,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0xfc,0x0f}; // d +glyph_line_t GLYPH_ATTR chr16_101[] = {0x0c,0xc0,0x07,0x20,0x09,0x20,0x09,0x20,0x09,0x20,0x09,0xc0,0x01}; // e +glyph_line_t GLYPH_ATTR chr16_102[] = {0x0c,0x20,0x00,0x20,0x00,0xf8,0x0f,0x24,0x00,0x24,0x00,0x04,0x00}; // f +glyph_line_t GLYPH_ATTR chr16_103[] = {0x0c,0xc0,0x07,0x20,0x28,0x20,0x28,0x20,0x28,0x20,0x28,0xe0,0x1f}; // g +glyph_line_t GLYPH_ATTR chr16_104[] = {0x0c,0xfc,0x0f,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0xc0,0x0f}; // h +glyph_line_t GLYPH_ATTR chr16_105[] = {0x06,0x20,0x08,0xec,0x0f,0x00,0x08}; // i +glyph_line_t GLYPH_ATTR chr16_106[] = {0x0a,0x00,0x18,0x00,0x20,0x00,0x20,0x20,0x20,0xec,0x1f}; // j +glyph_line_t GLYPH_ATTR chr16_107[] = {0x0c,0xfc,0x0f,0x00,0x01,0x00,0x01,0x80,0x02,0x40,0x04,0x20,0x08}; // k +glyph_line_t GLYPH_ATTR chr16_108[] = {0x06,0x04,0x08,0xfc,0x0f,0x00,0x08}; // l +glyph_line_t GLYPH_ATTR chr16_109[] = {0x0e,0xe0,0x0f,0x20,0x00,0x20,0x00,0xe0,0x0f,0x20,0x00,0x20,0x00,0xc0,0x0f}; // m +glyph_line_t GLYPH_ATTR chr16_110[] = {0x0c,0xe0,0x0f,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0xc0,0x0f}; // n +glyph_line_t GLYPH_ATTR chr16_111[] = {0x0c,0xc0,0x07,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0xc0,0x07}; // o +glyph_line_t GLYPH_ATTR chr16_112[] = {0x0c,0xe0,0x3f,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0xc0,0x07}; // p +glyph_line_t GLYPH_ATTR chr16_113[] = {0x0c,0xc0,0x07,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0xe0,0x3f}; // q +glyph_line_t GLYPH_ATTR chr16_114[] = {0x0c,0xe0,0x0f,0x40,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00}; // r +glyph_line_t GLYPH_ATTR chr16_115[] = {0x0c,0xc0,0x08,0x20,0x09,0x20,0x09,0x20,0x09,0x20,0x09,0x20,0x06}; // s +glyph_line_t GLYPH_ATTR chr16_116[] = {0x0c,0x20,0x00,0x20,0x00,0xfc,0x07,0x20,0x08,0x20,0x08,0x00,0x08}; // t +glyph_line_t GLYPH_ATTR chr16_117[] = {0x0c,0xe0,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0xe0,0x0f}; // u +glyph_line_t GLYPH_ATTR chr16_118[] = {0x0c,0xe0,0x00,0x00,0x03,0x00,0x0c,0x00,0x0c,0x00,0x03,0xe0,0x00}; // v +glyph_line_t GLYPH_ATTR chr16_119[] = {0x0e,0xe0,0x07,0x00,0x08,0x00,0x08,0x80,0x0f,0x00,0x08,0x00,0x08,0xe0,0x07}; // w +glyph_line_t GLYPH_ATTR chr16_120[] = {0x0c,0x60,0x0c,0x80,0x02,0x00,0x01,0x00,0x01,0x80,0x02,0x60,0x0c}; // x +glyph_line_t GLYPH_ATTR chr16_121[] = {0x0c,0xe0,0x07,0x00,0x28,0x00,0x28,0x00,0x28,0x00,0x28,0xe0,0x1f}; // y +glyph_line_t GLYPH_ATTR chr16_122[] = {0x0c,0x20,0x0c,0x20,0x0a,0x20,0x09,0xa0,0x08,0x60,0x08,0x20,0x08}; // z +glyph_line_t GLYPH_ATTR chr16_123[] = {0x08,0x40,0x00,0xb8,0x07,0x04,0x08,0x04,0x08}; // { +glyph_line_t GLYPH_ATTR chr16_124[] = {0x02,0xfc,0x0f}; // | +glyph_line_t GLYPH_ATTR chr16_125[] = {0x08,0x04,0x08,0x04,0x08,0xb8,0x07,0x40,0x00}; // } +glyph_line_t GLYPH_ATTR chr16_126[] = {0x0e,0x0c,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x06,0x00}; // ~ + const glyph_t terminus16[] GLYPH_ATTR = { - chr_032, - chr_033, - chr_034, - chr_035, - chr_036, - chr_037, - chr_038, - chr_039, - chr_040, - chr_041, - chr_042, - chr_043, - chr_044, - chr_045, - chr_046, - chr_047, - chr_048, - chr_049, - chr_050, - chr_051, - chr_052, - chr_053, - chr_054, - chr_055, - chr_056, - chr_057, - chr_058, - chr_059, - chr_060, - chr_061, - chr_062, - chr_063, - chr_064, - chr_065, - chr_066, - chr_067, - chr_068, - chr_069, - chr_070, - chr_071, - chr_072, - chr_073, - chr_074, - chr_075, - chr_076, - chr_077, - chr_078, - chr_079, - chr_080, - chr_081, - chr_082, - chr_083, - chr_084, - chr_085, - chr_086, - chr_087, - chr_088, - chr_089, - chr_090, - chr_091, - chr_092, - chr_093, - chr_094, - chr_095, - chr_096, - chr_097, - chr_098, - chr_099, - chr_100, - chr_101, - chr_102, - chr_103, - chr_104, - chr_105, - chr_106, - chr_107, - chr_108, - chr_109, - chr_110, - chr_111, - chr_112, - chr_113, - chr_114, - chr_115, - chr_116, - chr_117, - chr_118, - chr_119, - chr_120, - chr_121, - chr_122, - chr_123, - chr_124, - chr_125, - chr_126 + chr16_032, + chr16_033, + chr16_034, + chr16_035, + chr16_036, + chr16_037, + chr16_038, + chr16_039, + chr16_040, + chr16_041, + chr16_042, + chr16_043, + chr16_044, + chr16_045, + chr16_046, + chr16_047, + chr16_048, + chr16_049, + chr16_050, + chr16_051, + chr16_052, + chr16_053, + chr16_054, + chr16_055, + chr16_056, + chr16_057, + chr16_058, + chr16_059, + chr16_060, + chr16_061, + chr16_062, + chr16_063, + chr16_064, + chr16_065, + chr16_066, + chr16_067, + chr16_068, + chr16_069, + chr16_070, + chr16_071, + chr16_072, + chr16_073, + chr16_074, + chr16_075, + chr16_076, + chr16_077, + chr16_078, + chr16_079, + chr16_080, + chr16_081, + chr16_082, + chr16_083, + chr16_084, + chr16_085, + chr16_086, + chr16_087, + chr16_088, + chr16_089, + chr16_090, + chr16_091, + chr16_092, + chr16_093, + chr16_094, + chr16_095, + chr16_096, + chr16_097, + chr16_098, + chr16_099, + chr16_100, + chr16_101, + chr16_102, + chr16_103, + chr16_104, + chr16_105, + chr16_106, + chr16_107, + chr16_108, + chr16_109, + chr16_110, + chr16_111, + chr16_112, + chr16_113, + chr16_114, + chr16_115, + chr16_116, + chr16_117, + chr16_118, + chr16_119, + chr16_120, + chr16_121, + chr16_122, + chr16_123, + chr16_124, + chr16_125, + chr16_126 }; diff --git a/include/lib/pixelfont/ttf-to-font.py b/include/lib/pixelfont/ttf-to-font.py index 50297e5..38460fe 100755 --- a/include/lib/pixelfont/ttf-to-font.py +++ b/include/lib/pixelfont/ttf-to-font.py @@ -4,6 +4,14 @@ import PIL import PIL.ImageDraw import PIL.ImageFont +def invert(x): + ret = 0 + for i in range(8): + if x & (0x80 >> i): + ret |= 0x01 << i + return ret + + if __name__ == "__main__": font = PIL.ImageFont.truetype( "/usr/share/fonts/truetype/terminus/TerminusTTF-4.46.0.ttf", size=14 @@ -18,19 +26,21 @@ if __name__ == "__main__": if bbox is None: print( - "glyph_line_t GLYPH_ATTR chr_032[] = {0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; // <spac>" + "glyph_line_t GLYPH_ATTR chr16_032[] = {0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; // <spac>" ) continue left, upper, right, lower = bbox fontimg = fontimg.crop((left, 0, right, 15)) - fontimg = fontimg.transpose(PIL.Image.ROTATE_270) + fontimg = fontimg.transpose(PIL.Image.ROTATE_270).transpose(PIL.Image.FLIP_LEFT_RIGHT) fontbytes = fontimg.tobytes() glyph_len = len(fontbytes) - glyph_data = "{" + ",".join(map(lambda x: f"0x{x:02x}", fontbytes)) + "}" + glyph_data = "{" + f"0x{glyph_len:02x}," + ",".join(map(lambda x: f"0x{invert(x):02x}", fontbytes)) + "}" + + assert glyph_len % 2 == 0 print( - f"glyph_line_t GLYPH_ATTR chr_{char:03d}[] = {glyph_data}; // {chr(char)}" + f"glyph_line_t GLYPH_ATTR chr16_{char:03d}[] = {glyph_data}; // {chr(char)}" ) diff --git a/include/object/framebuffer.h b/include/object/framebuffer.h index c2edf22..119980a 100644 --- a/include/object/framebuffer.h +++ b/include/object/framebuffer.h @@ -9,12 +9,13 @@ class Framebuffer : public OutputStream Framebuffer(Framebuffer& copy); const glyph_t *font; unsigned int fontX, fontY; + unsigned char fontSize; unsigned char scale; public: unsigned char *data; - Framebuffer(unsigned char *data) : font(0), fontX(0), fontY(0), scale(1), data(data) {} + Framebuffer(unsigned char *data) : font(0), fontX(0), fontY(0), fontSize(1), scale(1), data(data) {} constexpr static unsigned int const width = CONFIG_framebuffer_width; constexpr static unsigned int const height = CONFIG_framebuffer_height; @@ -24,7 +25,7 @@ class Framebuffer : public OutputStream void fillBox(unsigned int x, unsigned int y, unsigned int w, unsigned int h); void drawAt(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned char *image); void drawBattery(unsigned int x, unsigned int y, unsigned char percent, bool charging = false); - void setFont(const glyph_t *font) { this->font = font; } + void setFont(const glyph_t *font, unsigned char fontSize = 1) { this->font = font; this->fontSize = fontSize; } void setPos(unsigned int newX, unsigned int newY) { fontX = newX; fontY = newY; } virtual void put(char c) override; }; diff --git a/src/os/object/framebuffer.cc b/src/os/object/framebuffer.cc index 1a22320..e605014 100644 --- a/src/os/object/framebuffer.cc +++ b/src/os/object/framebuffer.cc @@ -94,13 +94,15 @@ void Framebuffer::drawBattery(unsigned int x, unsigned int y, unsigned char perc void Framebuffer::scroll() { for (unsigned int pos_x = 0; pos_x < width; pos_x++) { - for (unsigned int pos_y = 1; pos_y < height/8; pos_y++) { - data[pos_x * (height/8) + pos_y - 1] = data[pos_x * (height/8) + pos_y]; + for (unsigned int pos_y = fontSize; pos_y < height/8; pos_y++) { + data[pos_x * (height/8) + pos_y - fontSize] = data[pos_x * (height/8) + pos_y]; + } + for (unsigned int pos_y = 1; pos_y <= fontSize; pos_y++) { + data[pos_x * (height/8) + height/8 - pos_y] = 0; } - data[pos_x * (height/8) + height/8 - 1] = 0; } - if (fontY >= 8) { - fontY -= 8; + if (fontY >= 8*fontSize) { + fontY -= 8*fontSize; } } @@ -111,7 +113,7 @@ void Framebuffer::put(char c) } if (c == '\n') { fontX = 0; - fontY += 8; + fontY += 8*fontSize; return; } if ((c < 32) || (c > 126)) { @@ -128,18 +130,22 @@ void Framebuffer::put(char c) if (fontX + glyph_w + 1 >= width) { put('\n'); } - if (fontY >= height) { + if (fontY + fontSize > height) { scroll(); } for (unsigned char i = 0; i < glyph_w; i++) { + unsigned char x = i / fontSize; + unsigned char y = i % fontSize; #ifdef MULTIPASS_ARCH_arduino_nano - data[(height/8) * (fontX + i) + fontY/8] = pgm_read_byte(&glyph_addr[i+1]); + data[(height/8) * (fontX + x) + fontY/8 + y] = pgm_read_byte(&glyph_addr[i+1]); #else - data[(height/8) * (fontX + i) + fontY/8] = glyph[i+1]; + data[(height/8) * (fontX + x) + fontY/8 + y] = glyph[i+1]; #endif } - data[(height/8) * (fontX + glyph_w + 1) + fontY/8] = 0; - fontX += glyph_w + 2; + for (unsigned char i = 0; i < fontSize; i++) { + data[(height/8) * (fontX + glyph_w + 1) + fontY/8] = 0; + } + fontX += (glyph_w / fontSize) + 2; } Framebuffer fb(framebuffer); |