From: Andrey Chilikin Date: Sun, 7 Dec 2014 21:19:53 +0000 (+0000) Subject: Font 6x8 added X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=d91c8110c26adec91446bbe8801f4c7fa3f72d4c;p=corbenik%2Fbdfe.git Font 6x8 added --- diff --git a/font6x8.h b/font6x8.h new file mode 100644 index 0000000..e5f3767 --- /dev/null +++ b/font6x8.h @@ -0,0 +1,111 @@ +// File generated by 'bdfe -n -r -s 32-126 koi5x8.bdf' +// COMMENT http://cvsweb.xfree86.org/cvsweb/xc/fonts/bdf/cyrillic/koi5x8.bdf +// COMMENT AUTOMATICALLY GENERATED FILE. DO NOT EDIT! +// COMMENT Generated with 'ucs2any.pl 5x8.bdf ../xcyr-2.3/tryfont/KOI8-C.TXT KOI8-C' +// COMMENT from an ISO10646-1 encoded source BDF font. +// COMMENT ucs2any.pl by Markus Kuhn , 1999. +// COMMENT Send bug reports to Markus Kuhn +// COMMENT Changes 1999 by Serge Winitzki. +// COMMENT $XFree86: xc/fonts/bdf/cyrillic/koi5x8.bdf,v 1.1 2002/12/15 01:49:06 dawes Exp $ +// FONT -Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-KOI8-R +// FONTBOUNDINGBOX 5 8 0 -1 +// FONT_DESCENT 1 +// FONT_ASCENT 7 +// COPYRIGHT "Public domain font. Share and enjoy." +// Converted Font Size 5x8 + + 0x00,0x00,0x00,0x00,0x00,0x00, // 32 ' ' + 0x00,0x00,0x5E,0x00,0x00,0x00, // 33 '!' + 0x00,0x0E,0x00,0x0E,0x00,0x00, // 34 '"' + 0x14,0x7F,0x14,0x7F,0x14,0x00, // 35 '#' + 0x04,0x2A,0x7F,0x2A,0x10,0x00, // 36 '$' + 0x00,0x16,0x08,0x34,0x00,0x00, // 37 '%' + 0x36,0x49,0x36,0x40,0x00,0x00, // 38 '&' + 0x00,0x00,0x0E,0x00,0x00,0x00, // 39 ''' + 0x00,0x3C,0x42,0x00,0x00,0x00, // 40 '(' + 0x00,0x42,0x3C,0x00,0x00,0x00, // 41 ')' + 0x54,0x38,0x38,0x54,0x00,0x00, // 42 '*' + 0x10,0x10,0x7C,0x10,0x10,0x00, // 43 '+' + 0x00,0x80,0x60,0x20,0x00,0x00, // 44 ',' + 0x10,0x10,0x10,0x10,0x00,0x00, // 45 '-' + 0x00,0x40,0xE0,0x40,0x00,0x00, // 46 '.' + 0x60,0x10,0x08,0x06,0x00,0x00, // 47 '/' + 0x00,0x3C,0x42,0x3C,0x00,0x00, // 48 '0' + 0x00,0x44,0x7E,0x40,0x00,0x00, // 49 '1' + 0x64,0x52,0x52,0x4C,0x00,0x00, // 50 '2' + 0x22,0x4A,0x4E,0x32,0x00,0x00, // 51 '3' + 0x18,0x14,0x7E,0x10,0x00,0x00, // 52 '4' + 0x2E,0x4A,0x4A,0x32,0x00,0x00, // 53 '5' + 0x3C,0x4A,0x4A,0x30,0x00,0x00, // 54 '6' + 0x02,0x62,0x1A,0x06,0x00,0x00, // 55 '7' + 0x34,0x4A,0x4A,0x34,0x00,0x00, // 56 '8' + 0x0C,0x52,0x52,0x3C,0x00,0x00, // 57 '9' + 0x00,0x6C,0x6C,0x00,0x00,0x00, // 58 ':' + 0x00,0x80,0x6C,0x2C,0x00,0x00, // 59 ';' + 0x00,0x18,0x24,0x42,0x00,0x00, // 60 '<' + 0x28,0x28,0x28,0x28,0x00,0x00, // 61 '=' + 0x00,0x42,0x24,0x18,0x00,0x00, // 62 '>' + 0x00,0x04,0x52,0x0C,0x00,0x00, // 63 '?' + 0x3C,0x42,0x99,0xA5,0x1E,0x00, // 64 '@' + 0x7C,0x12,0x12,0x7C,0x00,0x00, // 65 'A' + 0x7E,0x4A,0x4A,0x34,0x00,0x00, // 66 'B' + 0x3C,0x42,0x42,0x24,0x00,0x00, // 67 'C' + 0x7E,0x42,0x42,0x3C,0x00,0x00, // 68 'D' + 0x7E,0x4A,0x4A,0x42,0x00,0x00, // 69 'E' + 0x7E,0x0A,0x0A,0x02,0x00,0x00, // 70 'F' + 0x3C,0x42,0x52,0x34,0x00,0x00, // 71 'G' + 0x7E,0x08,0x08,0x7E,0x00,0x00, // 72 'H' + 0x00,0x42,0x7E,0x42,0x00,0x00, // 73 'I' + 0x20,0x42,0x3E,0x02,0x00,0x00, // 74 'J' + 0x7E,0x08,0x34,0x42,0x00,0x00, // 75 'K' + 0x7E,0x40,0x40,0x40,0x00,0x00, // 76 'L' + 0x7E,0x0C,0x0C,0x7E,0x00,0x00, // 77 'M' + 0x7E,0x0C,0x38,0x7E,0x00,0x00, // 78 'N' + 0x3C,0x42,0x42,0x3C,0x00,0x00, // 79 'O' + 0x7E,0x12,0x12,0x0C,0x00,0x00, // 80 'P' + 0x3C,0x52,0x62,0xBC,0x00,0x00, // 81 'Q' + 0x7E,0x12,0x12,0x6C,0x00,0x00, // 82 'R' + 0x24,0x4A,0x52,0x24,0x00,0x00, // 83 'S' + 0x00,0x02,0x7E,0x02,0x00,0x00, // 84 'T' + 0x3E,0x40,0x40,0x3E,0x00,0x00, // 85 'U' + 0x1E,0x60,0x60,0x1E,0x00,0x00, // 86 'V' + 0x7E,0x30,0x30,0x7E,0x00,0x00, // 87 'W' + 0x66,0x18,0x18,0x66,0x00,0x00, // 88 'X' + 0x06,0x08,0x70,0x08,0x06,0x00, // 89 'Y' + 0x62,0x52,0x4A,0x46,0x00,0x00, // 90 'Z' + 0x00,0x7E,0x42,0x42,0x00,0x00, // 91 '[' + 0x06,0x08,0x10,0x60,0x00,0x00, // 92 '\' + 0x00,0x42,0x42,0x7E,0x00,0x00, // 93 ']' + 0x00,0x04,0x02,0x04,0x00,0x00, // 94 '^' + 0x80,0x80,0x80,0x80,0x00,0x00, // 95 '_' + 0x00,0x02,0x04,0x00,0x00,0x00, // 96 '`' + 0x30,0x48,0x48,0x78,0x00,0x00, // 97 'a' + 0x7E,0x48,0x48,0x30,0x00,0x00, // 98 'b' + 0x00,0x30,0x48,0x48,0x00,0x00, // 99 'c' + 0x30,0x48,0x48,0x7E,0x00,0x00, // 100 'd' + 0x30,0x68,0x58,0x10,0x00,0x00, // 101 'e' + 0x10,0x7C,0x12,0x04,0x00,0x00, // 102 'f' + 0x10,0xA8,0xA8,0x70,0x00,0x00, // 103 'g' + 0x7E,0x08,0x08,0x70,0x00,0x00, // 104 'h' + 0x00,0x48,0x7A,0x40,0x00,0x00, // 105 'i' + 0x00,0x40,0x80,0x7A,0x00,0x00, // 106 'j' + 0x7E,0x10,0x10,0x68,0x00,0x00, // 107 'k' + 0x00,0x42,0x7E,0x40,0x00,0x00, // 108 'l' + 0x78,0x08,0x70,0x08,0x70,0x00, // 109 'm' + 0x78,0x08,0x08,0x70,0x00,0x00, // 110 'n' + 0x30,0x48,0x48,0x30,0x00,0x00, // 111 'o' + 0xF8,0x28,0x28,0x10,0x00,0x00, // 112 'p' + 0x10,0x28,0x28,0xF8,0x00,0x00, // 113 'q' + 0x78,0x10,0x08,0x10,0x00,0x00, // 114 'r' + 0x00,0x50,0x58,0x28,0x00,0x00, // 115 's' + 0x08,0x3E,0x48,0x20,0x00,0x00, // 116 't' + 0x38,0x40,0x40,0x78,0x00,0x00, // 117 'u' + 0x00,0x38,0x40,0x38,0x00,0x00, // 118 'v' + 0x38,0x40,0x30,0x40,0x38,0x00, // 119 'w' + 0x48,0x30,0x30,0x48,0x00,0x00, // 120 'x' + 0x58,0xA0,0xA0,0x78,0x00,0x00, // 121 'y' + 0x48,0x68,0x58,0x48,0x00,0x00, // 122 'z' + 0x08,0x2A,0x55,0x41,0x00,0x00, // 123 '{' + 0x00,0x00,0x7E,0x00,0x00,0x00, // 124 '|' + 0x41,0x55,0x2A,0x08,0x00,0x00, // 125 '}' + 0x04,0x02,0x04,0x02,0x00,0x00, // 126 '~' diff --git a/ossd_i2c.c b/ossd_i2c.c index 39eba4d..d012a77 100644 --- a/ossd_i2c.c +++ b/ossd_i2c.c @@ -103,6 +103,10 @@ #define OSSD_CHARGE_PUMP_ON 0x14 #define OSSD_CHARGE_PUMP_OFF 0x10 +static const uint8_t font68[] PROGMEM = { +#include "font6x8.h" +}; + static const uint8_t font88[] PROGMEM = { #include "font88.h" }; @@ -112,6 +116,7 @@ static const uint8_t font816[] PROGMEM = { }; static ossd_font_t _ofont[OSSD_FONT_MAX+1] = { + { 6, 8, 32, 127-32, font68 }, { 8, 8, 32, 127-32, font88 }, { 8, 16, 32, 127-32, font816 }, { 0, 0, 0, 0, NULL } @@ -343,16 +348,17 @@ void ossd_putlx(uint8_t line, int8_t x, const char *str, uint8_t atr) uint8_t gw = _ofont[_cfont].gw; uint8_t gh = _ofont[_cfont].gh; uint8_t go = _ofont[_cfont].go; + uint8_t gb = gw*(gh / 8); // bytes per glyph const uint8_t *font = _ofont[_cfont].font; uint8_t cmode = ossd_set_addr_mode(OSSD_ADDR_MODE_HOR); for(; *str != '\0'; str++, x += gw) { - uint16_t idx = (*str - go) * gh; + uint16_t idx = (*str - go) * gb; if ((uint8_t)x > (128 - gw)) { x = 0; line = (line + (gh+7)/8) & 0x07; } ossd_goto(line, x); - for(uint8_t i = 0; i < gh; i++) { + for(uint8_t i = 0; i < gb; i++) { uint8_t d = pgm_read_byte(&font[idx+i]); d ^= rev; if (under && (gh == 8 || i > (gw - 1))) diff --git a/ossd_i2c.h b/ossd_i2c.h index 747528f..9a45cad 100644 --- a/ossd_i2c.h +++ b/ossd_i2c.h @@ -55,9 +55,10 @@ extern "C" { #include #endif -#define OSSD_FONT_8x8 0 -#define OSSD_FONT_8x16 1 -#define OSSD_FONT_USER 2 +#define OSSD_FONT_6x8 0 +#define OSSD_FONT_8x8 1 +#define OSSD_FONT_8x16 2 +#define OSSD_FONT_USER 3 #define OSSD_FONT_MAX OSSD_FONT_USER typedef struct ossd_font_s