Go Down

Topic: changement de police de caractere dans un skecth (Read 1 time) previous topic - next topic

dracub

deuxième partie du post car je dépasse  le nombre de caractères ....
Code: [Select]
// ==========================================================================================
//   font
// ==========================================================================================

        const unsigned char font[455] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x5f,0x00,0x00, //  !
0x00,0x03,0x00,0x03,0x00,0x14,0x7f,0x14,0x7f,0x14, // "#
0x24,0x2a,0x7f,0x2a,0x12,0x23,0x13,0x08,0x64,0x62, // $%
0x36,0x49,0x55,0x22,0x50,0x00,0x05,0x03,0x00,0x00, // &'
0x00,0x1c,0x22,0x41,0x00,0x00,0x41,0x22,0x1c,0x00, // ()
0x14,0x08,0x3e,0x08,0x14,0x08,0x08,0x3e,0x08,0x08, // *+
0x00,0x50,0x30,0x00,0x00,0x08,0x08,0x08,0x08,0x08, // ,-
0x00,0x60,0x60,0x00,0x00,0x20,0x10,0x08,0x04,0x02, // ./
0x3e,0x51,0x49,0x45,0x3e,0x00,0x42,0x7f,0x40,0x00, // 01
0x42,0x61,0x51,0x49,0x46,0x21,0x41,0x45,0x4b,0x31, // 23
0x18,0x14,0x12,0x7f,0x10,0x27,0x45,0x45,0x45,0x39, // 45
0x3c,0x4a,0x49,0x49,0x30,0x01,0x71,0x09,0x05,0x03, // 67
0x36,0x49,0x49,0x49,0x36,0x06,0x49,0x49,0x29,0x1e, // 89
0x00,0x36,0x36,0x00,0x00,0x00,0x56,0x36,0x00,0x00, // :;
0x08,0x14,0x22,0x41,0x00,0x14,0x14,0x14,0x14,0x14, // <=
0x00,0x41,0x22,0x14,0x08,0x02,0x01,0x51,0x09,0x06, // >?
0x32,0x49,0x79,0x41,0x3e,0x7e,0x11,0x11,0x11,0x7e, // @A
0x7f,0x49,0x49,0x49,0x36,0x3e,0x41,0x41,0x41,0x22, // BC
0x7f,0x41,0x41,0x22,0x1c,0x7f,0x49,0x49,0x49,0x41, // DE
0x7f,0x09,0x09,0x09,0x01,0x3e,0x41,0x49,0x49,0x7a, // FG
0x7f,0x08,0x08,0x08,0x7f,0x00,0x41,0x7f,0x41,0x00, // HI
0x20,0x43,0x41,0x3f,0x00,0x7f,0x08,0x14,0x22,0x41, // JK
0x7f,0x40,0x40,0x40,0x40,0x7f,0x02,0x0c,0x02,0x7f, // LM
0x7f,0x04,0x08,0x10,0x7f,0x3e,0x41,0x41,0x41,0x3e, // NO
0x7f,0x09,0x09,0x09,0x06,0x3e,0x41,0x51,0x21,0x5e, // PQ
0x7f,0x09,0x19,0x29,0x46,0x46,0x49,0x49,0x49,0x31, // RS
0x01,0x01,0x7f,0x01,0x01,0x3f,0x40,0x40,0x40,0x3f, // TU
0x1f,0x20,0x40,0x20,0x1f,0x3f,0x40,0x38,0x40,0x3f, // VW
0x63,0x14,0x08,0x14,0x63,0x07,0x08,0x70,0x08,0x07, // XY
0x61,0x51,0x49,0x45,0x43,0x00,0x7f,0x41,0x41,0x00, // Z[
0x02,0x04,0x08,0x10,0x20,0x00,0x41,0x41,0x7f,0x00, // \]
0x04,0x02,0x01,0x02,0x04,0x40,0x40,0x40,0x40,0x40, // ^_
0x00,0x01,0x02,0x04,0x00,0x20,0x54,0x54,0x54,0x78, // `a
0x7f,0x48,0x44,0x44,0x38,0x38,0x44,0x44,0x44,0x20, // bc
0x38,0x44,0x44,0x48,0x7f,0x38,0x54,0x54,0x54,0x18, // de
0x08,0x7e,0x09,0x01,0x02,0x0c,0x52,0x52,0x52,0x3e, // fg
0x7f,0x08,0x04,0x04,0x78,0x00,0x44,0x7d,0x40,0x00, // hi
0x20,0x40,0x44,0x3d,0x00,0x7f,0x10,0x28,0x44,0x00, // jk
0x00,0x41,0x7f,0x40,0x00,0x7c,0x04,0x18,0x04,0x78, // lm
0x7c,0x08,0x04,0x04,0x78,0x38,0x44,0x44,0x44,0x38, // no
0x7c,0x14,0x14,0x14,0x08,0x08,0x14,0x14,0x18,0x7c, // pq
0x7c,0x08,0x04,0x04,0x08,0x48,0x54,0x54,0x54,0x20, // rs
0x04,0x3f,0x44,0x40,0x20,0x3c,0x40,0x40,0x20,0x7c, // tu
0x1c,0x20,0x40,0x20,0x1c,0x3c,0x40,0x30,0x40,0x3c, // vw
0x44,0x28,0x10,0x28,0x44,0x0c,0x50,0x50,0x50,0x3c, // xy
0x44,0x64,0x54,0x4c,0x44 // z
};
        const unsigned char bitmaps[37][8] = {
{0xc3,0xc3,0x00,0x18,0x18,0x81,0xff,0x7e}, // smiley 3 small
{0x3c,0x42,0x81,0x81,0xc3,0x24,0xa5,0xe7}, // Omega
{0x00,0x04,0x06,0xff,0xff,0x06,0x04,0x00},  // Arrow
{0x81,0x42,0x24,0x18,0x18,0x24,0x42,0x81}, // X
{0xBD,0xA1,0xA1,0xB9,0xA1,0xA1,0xA1,0x00}, // ifi
{0xEF,0x48,0x4B,0x49,0x4F,0x00,0x00,0x00}, // TG
        {0x08,0x04,0x02,0x01,0x01,0x01,0x01,0x01}, // lower sinewave
        {0x10,0x20,0x40,0x80,0x80,0x02,0x02,0x02}, // upper sinewave
        {0x99,0x24,0x42,0x99,0x99,0x42,0x24,0x99}, //  round pattern
        {0xFF,0x81,0xBD,0xA5,0xA5,0xBD,0x81,0xFF}, //  box pattern inner
        {0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA}, //  fine checkers
        {0x33,0x33,0xCC,0xCC,0x33,0x33,0xCC,0xCC}, //  big checkers
        {0x42,0xC3,0x24,0x18,0x18,0x24,0xC3,0x42}, // 12 X pattern
        {0xFD,0x85,0xB5,0xA5,0xA5,0xBD,0x81,0xFF}, //  sprial
        {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, //  8x8 block
        {0xFF,0x7E,0x7E,0x7E,0x7E,0x42,0x24,0x18}, //  bullet Right
        {0x18,0x18,0x3C,0x66,0x66,0x3C,0x18,0x18}, //  chain link
        {0x78,0x78,0x18,0xFF,0xFF,0x0C,0x3C,0x3C}, //  cactus
        {0xF2,0x82,0x12,0x3A,0x10,0xC0,0xC4,0x0E}, //  tetris
        {0x7F,0x84,0xA7,0x84,0xA7,0x84,0x7F,0x00}, // 19 pacman ghost
        {0x3C,0x42,0x81,0xA1,0x89,0x95,0xA5,0x42}, // 20 pacman
        {0x07,0x2F,0x1C,0x3E,0x3C,0x30,0x30,0x30}, //  gun
        {0x5A,0x99,0x00,0x18,0x18,0x00,0x18,0x18}, //  gun bullets
        {0x82,0x41,0x82,0x41,0x82,0x41,0x82,0x41}, //  checkers edges
        {0x00,0x01,0x06,0x7E,0xDF,0x7E,0x06,0x01}, //  rocket
        {0x04,0x0F,0x1F,0x3C,0x3C,0x1F,0x0F,0x04}, //  house
        {0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00}, //  vertical stripes
        {0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55}, //  horizontal strips
        {0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92}, //  diag strips left
        {0x92,0x49,0x24,0x92,0x49,0x24,0x92,0x49}, //  diag strips rights
        {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}, //  arrow shaft
        {0x18,0x18,0x3C,0x5A,0x99,0x3C,0x42,0x81}, //  arrow tail}
        {0x18,0x3C,0x7E,0xFF,0x18,0x18,0x18,0x18}, //  arrow head
        {0x81,0x42,0x24,0x18,0x81,0x42,0x24,0x18}, //  carrots L
        {0x18,0x24,0x42,0x81,0x18,0x24,0x42,0x81}, //  carrots R
        {0x81,0x42,0x24,0x99,0x5A,0x3C,0x18,0x18}, //  tail good
        {0x18,0x18,0x18,0x18,0xFF,0x7E,0x3C,0x18}  // 36 head good



};
        const unsigned char paths[44] = {
        0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x10,0x20,0x30,
        0x40,0x50,0x60,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,
        0x67,0x57,0x47,0x37,0x27,0x17,0x04,0x03,0x12,0x21,0x30,
        0x40,0x51,0x62,0x73,0x74,0x65,0x56,0x47,0x37,0x26,0x15}; // circle, len 16, offset 28

void font_getpath (unsigned char path, unsigned char *destination, int length)
{
int i;
int offset = 0;

if (path == 1)
offset=28;

for (i = 0; i < length; i++)
  destination[i] = paths[i+offset];
}

void font_getchar (char chr, unsigned char dst[5])
{
int i;
chr -= 32;

        unsigned char font[455] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x5f,0x00,0x00, //  !
0x00,0x03,0x00,0x03,0x00,0x14,0x7f,0x14,0x7f,0x14, // "#
0x24,0x2a,0x7f,0x2a,0x12,0x23,0x13,0x08,0x64,0x62, // $%
0x36,0x49,0x55,0x22,0x50,0x00,0x05,0x03,0x00,0x00, // &'
0x00,0x1c,0x22,0x41,0x00,0x00,0x41,0x22,0x1c,0x00, // ()
0x14,0x08,0x3e,0x08,0x14,0x08,0x08,0x3e,0x08,0x08, // *+
0x00,0x50,0x30,0x00,0x00,0x08,0x08,0x08,0x08,0x08, // ,-
0x00,0x60,0x60,0x00,0x00,0x20,0x10,0x08,0x04,0x02, // ./
0x3e,0x51,0x49,0x45,0x3e,0x00,0x42,0x7f,0x40,0x00, // 01
0x42,0x61,0x51,0x49,0x46,0x21,0x41,0x45,0x4b,0x31, // 23
0x18,0x14,0x12,0x7f,0x10,0x27,0x45,0x45,0x45,0x39, // 45
0x3c,0x4a,0x49,0x49,0x30,0x01,0x71,0x09,0x05,0x03, // 67
0x36,0x49,0x49,0x49,0x36,0x06,0x49,0x49,0x29,0x1e, // 89
0x00,0x36,0x36,0x00,0x00,0x00,0x56,0x36,0x00,0x00, // :;
0x08,0x14,0x22,0x41,0x00,0x14,0x14,0x14,0x14,0x14, // <=
0x00,0x41,0x22,0x14,0x08,0x02,0x01,0x51,0x09,0x06, // >?
0x32,0x49,0x79,0x41,0x3e,0x7e,0x11,0x11,0x11,0x7e, // @A
0x7f,0x49,0x49,0x49,0x36,0x3e,0x41,0x41,0x41,0x22, // BC
0x7f,0x41,0x41,0x22,0x1c,0x7f,0x49,0x49,0x49,0x41, // DE
0x7f,0x09,0x09,0x09,0x01,0x3e,0x41,0x49,0x49,0x7a, // FG
0x7f,0x08,0x08,0x08,0x7f,0x00,0x41,0x7f,0x41,0x00, // HI
0x20,0x40,0x41,0x3f,0x01,0x7f,0x08,0x14,0x22,0x41, // JK
0x7f,0x40,0x40,0x40,0x40,0x7f,0x02,0x0c,0x02,0x7f, // LM
0x7f,0x04,0x08,0x10,0x7f,0x3e,0x41,0x41,0x41,0x3e, // NO
0x7f,0x09,0x09,0x09,0x06,0x3e,0x41,0x51,0x21,0x5e, // PQ
0x7f,0x09,0x19,0x29,0x46,0x46,0x49,0x49,0x49,0x31, // RS
0x01,0x01,0x7f,0x01,0x01,0x3f,0x40,0x40,0x40,0x3f, // TU
0x1f,0x20,0x40,0x20,0x1f,0x3f,0x40,0x38,0x40,0x3f, // VW
0x63,0x14,0x08,0x14,0x63,0x07,0x08,0x70,0x08,0x07, // XY
0x61,0x51,0x49,0x45,0x43,0x00,0x7f,0x41,0x41,0x00, // Z[
0x02,0x04,0x08,0x10,0x20,0x00,0x41,0x41,0x7f,0x00, // \]
0x04,0x02,0x01,0x02,0x04,0x40,0x40,0x40,0x40,0x40, // ^_
0x00,0x01,0x02,0x04,0x00,0x20,0x54,0x54,0x54,0x78, // `a
0x7f,0x48,0x44,0x44,0x38,0x38,0x44,0x44,0x44,0x20, // bc
0x38,0x44,0x44,0x48,0x7f,0x38,0x54,0x54,0x54,0x18, // de
0x08,0x7e,0x09,0x01,0x02,0x0c,0x52,0x52,0x52,0x3e, // fg
0x7f,0x08,0x04,0x04,0x78,0x00,0x44,0x7d,0x40,0x00, // hi
0x20,0x40,0x44,0x3d,0x00,0x7f,0x10,0x28,0x44,0x00, // jk
0x00,0x41,0x7f,0x40,0x00,0x7c,0x04,0x18,0x04,0x78, // lm
0x7c,0x08,0x04,0x04,0x78,0x38,0x44,0x44,0x44,0x38, // no
0x7c,0x14,0x14,0x14,0x08,0x08,0x14,0x14,0x18,0x7c, // pq
0x7c,0x08,0x04,0x04,0x08,0x48,0x54,0x54,0x54,0x20, // rs
0x04,0x3f,0x44,0x40,0x20,0x3c,0x40,0x40,0x20,0x7c, // tu
0x1c,0x20,0x40,0x20,0x1c,0x3c,0x40,0x30,0x40,0x3c, // vw
0x44,0x28,0x10,0x28,0x44,0x0c,0x50,0x50,0x50,0x3c, // xy
0x44,0x64,0x54,0x4c,0x44 // z
    };
    for (i = 0; i < 5; i++)
    {
dst[i] = font[((uint8_t)chr*5)+((uint8_t)i)];
}
}

void font_getbitmap (char bitmap, unsigned char dst[8])
{
int i;

        for (i = 0; i < 8; i++)
  dst[i] = bitmaps[(uint8_t)bitmap][(uint8_t)i];
}

unsigned char font_getbitmappixel ( char bitmap, char x, char y)
{
uint8_t tmp = bitmaps[(uint8_t)bitmap][(uint8_t)x];
  return (tmp >> y) & 0x01;
}



en tous cas merci d' avance ....

ProfT

bonsoir,

faut il que le cube soit multiplexé? le mien n'y est pas et il fait 7x7x7, que faudrait il modifier pour que je puisse adapter votre prog  à mon cube?
merci pour vos réponses.

Go Up