123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- /*
- * font.c
- *
- * Copyright 2012 Thomas Buck <xythobuz@me.com>
- *
- * This file is part of LED-Cube.
- *
- * LED-Cube is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * LED-Cube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with LED-Cube. If not, see <http://www.gnu.org/licenses/>.
- */
- #include <stdint.h>
- #include <avr/io.h>
- #include <avr/pgmspace.h>
-
- uint8_t font[95][8];
- uint8_t fontBuff[8];
-
- uint8_t *getFont(char c) {
- uint8_t i;
- if (!((c >= 0x20) && (c <= 0x7E))) {
- c = '?';
- }
- for (i = 0; i < 8; i++) {
- fontBuff[i] = pgm_read_byte(&(font[(uint8_t)(c - 0x20)][i]));
- }
- return fontBuff;
- }
-
-
- // Source: http://www.mikrocontroller.net/topic/54860
- // Author: Benedikt K
- // This is a LCD Font originally for Codepage 850.
- // Because of size restraints, i cut everything but
- // the printable ascii range, 0x20 to 0x7E
- // Not really pretty on the cube, but enough for now.
- // I already replaced everything but lowercase letters
- uint8_t font[95][8] PROGMEM = {
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 20 SPACE
- {0x7e, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18}, // 21 !
- {0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00}, // 22 "
- {0x66, 0xff, 0xff, 0x66, 0x66, 0xff, 0xff, 0x66}, // 23 #
- {0x18, 0xff, 0x19, 0x19, 0xfe, 0x98, 0xff, 0x18}, // 24 $
- {0x87, 0x45, 0x27, 0x10, 0x08, 0xe4, 0xa2, 0xe1}, // 25 %
- {0x1e, 0x33, 0x33, 0xde, 0xee, 0x3b, 0x73, 0xdc}, // 26 &
- {0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // 27 '
- {0x18, 0x0c, 0x06, 0x03, 0x03, 0x06, 0x0c, 0x18}, // 28 (
- {0x18, 0x38, 0x60, 0xc0, 0xc0, 0x60, 0x38, 0x18}, // 29 )
- {0x99, 0x5a, 0x3c, 0xff, 0xff, 0x3c, 0x5a, 0x99}, // 2A *
- {0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18}, // 2B +
- {0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x0c}, // 2C ,
- {0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00}, // 2D -
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00}, // 2E .
- {0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x03}, // 2F /
-
- {0x7e, 0xff, 0xe3, 0xd3, 0xcb, 0xc7, 0xff, 0x7e}, // 30 0
- {0x38, 0x3c, 0x36, 0x33, 0x31, 0x30, 0x30, 0x30}, // 31 1
- {0x7c, 0x7e, 0x62, 0x30, 0x18, 0x0c, 0x7e, 0x7e}, // 32 2
- {0x7e, 0xff, 0xc0, 0x78, 0x78, 0xc0, 0xff, 0x7e}, // 33 3
- {0xc3, 0xc3, 0xc3, 0xff, 0xff, 0xc0, 0xc0, 0xc0}, // 34 4
- {0xff, 0xff, 0x03, 0x3f, 0x7e, 0xc0, 0x7f, 0x3f}, // 35 5
- {0xfe, 0xff, 0x03, 0x7f, 0xff, 0xc3, 0xff, 0x7e}, // 36 6
- {0x7e, 0xff, 0xe0, 0x70, 0xfe, 0x1c, 0x0e, 0x07}, // 37 7
- {0x3c, 0x7e, 0xc3, 0x7e, 0x7e, 0xc3, 0x7e, 0x3c}, // 38 8
- {0x7e, 0xff, 0xc3, 0xff, 0xbe, 0x80, 0xff, 0x7e}, // 39 9
-
- {0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00}, // 3A :
- {0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x0c}, // 3B ;
- {0xe0, 0x38, 0x0e, 0x03, 0x03, 0x0e, 0x38, 0xe0}, // 3C <
- {0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00}, // 3D =
- {0x07, 0x1c, 0x70, 0xc0, 0xc0, 0x70, 0x1c, 0x07}, // 3E >
- {0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18}, // 3F ?
- {0x7e, 0xff, 0xc3, 0x3b, 0x3b, 0x03, 0xff, 0x7e}, // 40 @
-
- {0x7e, 0xff, 0xc3, 0xc3, 0xff, 0xff, 0xc3, 0xc3}, // 41 A
- {0x7f, 0x83, 0x83, 0x83, 0x7f, 0x83, 0x83, 0x7f}, // 42 B
- {0x7e, 0xff, 0x03, 0x03, 0x03, 0x03, 0xff, 0x7e}, // 43 C
- {0x1e, 0x3f, 0x63, 0xc3, 0xc3, 0x63, 0x3f, 0x1e}, // 44 D
- {0xfe, 0xff, 0x03, 0x3f, 0x3f, 0x03, 0xff, 0xfe}, // 45 E
- {0xfe, 0xff, 0x03, 0x3f, 0x3f, 0x03, 0x03, 0x03}, // 46 F
- {0xfe, 0xff, 0x03, 0x63, 0xf3, 0xc3, 0xff, 0x7e}, // 47 G
- {0xc3, 0xc3, 0xc3, 0xff, 0xff, 0xc3, 0xc3, 0xc3}, // 48 H
- {0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c}, // 49 I
- {0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc6, 0x66, 0x3c}, // 4A J
- {0xc3, 0x63, 0x33, 0x1f, 0x1f, 0x33, 0x63, 0xc3}, // 4B K
- {0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xff, 0xff}, // 4C L
- {0x66, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xc3, 0xc3}, // 4D M
- {0xc7, 0xcf, 0xcf, 0xdb, 0xdb, 0xf3, 0xf3, 0xe3}, // 4E N
- {0x7e, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e}, // 4F O
- {0x3e, 0x7f, 0xc3, 0xc3, 0x7f, 0x3f, 0x03, 0x03}, // 50 P
- {0x3c, 0x7e, 0xc3, 0xc3, 0xd3, 0xe3, 0x7e, 0xbc}, // 51 Q
- {0x3e, 0x7f, 0xc3, 0x7f, 0x3f, 0x1f, 0x3b, 0x73}, // 52 R
- {0xfe, 0xff, 0x03, 0x7f, 0xfe, 0x80, 0xff, 0x7f}, // 53 S
- {0xff, 0xff, 0x99, 0x18, 0x18, 0x18, 0x18, 0x3c}, // 54 T
- {0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e}, // 55 U
- {0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18}, // 56 V
- {0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xdb, 0xff, 0x7e}, // 57 W
- {0xc3, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0xc3}, // 58 X
- {0x81, 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18}, // 59 Y
- {0xfe, 0xff, 0x70, 0x38, 0x1c, 0x0e, 0xff, 0x7f}, // 5A Z
-
- {0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0xff, 0xff}, // 5B [
- {0x03, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xc0}, // 5C Backslash
- {0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff}, // 5D ]
- {0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00}, // 5E ^
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff}, // 5F _
- {0x0e, 0x1c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00}, // 60 `
-
- {0x00,0x00,0x1E,0x30,0x3E,0x33,0x6E,0x00}, // 61 a
- {0x07,0x06,0x3E,0x66,0x66,0x66,0x3D,0x00}, // 62 b
- {0x00,0x00,0x1E,0x33,0x03,0x33,0x1E,0x00}, // 63 c
- {0x38,0x30,0x30,0x3E,0x33,0x33,0x6E,0x00}, // 64 d
- {0x00,0x00,0x1E,0x33,0x3F,0x03,0x1E,0x00}, // 65 e
- {0x1C,0x36,0x06,0x0F,0x06,0x06,0x0F,0x00}, // 66 f
- {0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x1F}, // 67 g
- {0x07,0x06,0x36,0x6E,0x66,0x66,0x67,0x00}, // 68 h
- {0x0C,0x00,0x0E,0x0C,0x0C,0x0C,0x1E,0x00}, // 69 i
- {0x18,0x00,0x1E,0x18,0x18,0x18,0x1B,0x0E}, // 6A j
- {0x07,0x06,0x66,0x36,0x1E,0x36,0x67,0x00}, // 6B k
- {0x0E,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00}, // 6C l
- {0x00,0x00,0x37,0x7F,0x6B,0x63,0x63,0x00}, // 6D m
- {0x00,0x00,0x1F,0x33,0x33,0x33,0x33,0x00}, // 6E n
- {0x00,0x00,0x1E,0x33,0x33,0x33,0x1E,0x00}, // 6F o
- {0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x0F}, // 70 p
- {0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x78}, // 71 q
- {0x00,0x00,0x1B,0x36,0x36,0x06,0x0F,0x00}, // 72 r
- {0x00,0x00,0x3E,0x03,0x1E,0x30,0x1F,0x00}, // 73 s
- {0x08,0x0C,0x3E,0x0C,0x0C,0x2C,0x18,0x00}, // 74 t
- {0x00,0x00,0x33,0x33,0x33,0x33,0x6E,0x00}, // 75 u
- {0x00,0x00,0x33,0x33,0x33,0x1E,0x0C,0x00}, // 76 v
- {0x00,0x00,0x63,0x63,0x6B,0x7F,0x36,0x00}, // 77 w
- {0x00,0x00,0x63,0x36,0x1C,0x36,0x63,0x00}, // 78 x
- {0x00,0x00,0x33,0x33,0x33,0x3E,0x30,0x1F}, // 79 y
- {0x00,0x00,0x3F,0x19,0x0C,0x26,0x3F,0x00}, // 7A z
-
- {0xf8, 0xfc, 0x0c, 0x07, 0x07, 0x0c, 0xfc, 0xf8}, // 7B {
- {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, // 7C |
- {0x1f, 0x3f, 0x30, 0xe0, 0xe0, 0x30, 0x3f, 0x1f}, // 7D }
- {0x00, 0x04, 0x0e, 0x0b, 0x99, 0xd0, 0x70, 0x20}, // 7E ~
- };
|