Hi all,
I am trying to create a smaller font (5x8) for an OLED SPI screen.
So far, what I did , without success :
In oled_fonts.h
I added extern FontDef Font_5x8;
In oled_fonts.c
, I added
static const uint16_t Font5x8 [] = {
/* -- -- */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- " -- */
0x000A, 0x000A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- # -- */
0x000A, 0x001F, 0x000A, 0x001F, 0x000A, 0x0000, 0x0000, 0x0000,
/* -- $ -- */
0x001F, 0x0014, 0x001F, 0x0005, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- % -- */
0x0019, 0x001A, 0x0004, 0x000B, 0x0013, 0x0000, 0x0000, 0x0000,
/* -- & -- */
0x001E, 0x0012, 0x001F, 0x0012, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- ' -- */
0x0004, 0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- ( -- */
0x0002, 0x0004, 0x0004, 0x0004, 0x0002, 0x0000, 0x0000, 0x0000,
/* -- ) -- */
0x0008, 0x0004, 0x0004, 0x0004, 0x0008, 0x0000, 0x0000, 0x0000,
/* -- * -- */
0x0000, 0x000A, 0x0004, 0x000A, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- + -- */
0x0000, 0x0004, 0x000E, 0x0004, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- , -- */
0x0000, 0x0000, 0x0000, 0x0004, 0x0008, 0x0000, 0x0000, 0x0000,
/* -- - -- */
0x0000, 0x0000, 0x000E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- . -- */
0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000,
/* -- / -- */
0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0000, 0x0000, 0x0000,
/* -- 0 -- */
0x001F, 0x0013, 0x0015, 0x0019, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- 1 -- */
0x000C, 0x0004, 0x0004, 0x0004, 0x000E, 0x0000, 0x0000, 0x0000,
/* -- 2 -- */
0x001F, 0x0001, 0x001F, 0x0010, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- 3 -- */
0x001F, 0x0001, 0x000F, 0x0001, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- 4 -- */
0x0011, 0x0011, 0x001F, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000,
/* -- 5 -- */
0x001F, 0x0010, 0x001E, 0x0001, 0x001E, 0x0000, 0x0000, 0x0000,
/* -- 6 -- */
0x001F, 0x0010, 0x001F, 0x0011, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- 7 -- */
0x001F, 0x0011, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000,
/* -- 8 -- */
0x001F, 0x0011, 0x001F, 0x0011, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- 9 -- */
0x001F, 0x0011, 0x001F, 0x0001, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- : -- */
0x0000, 0x0008, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- ; -- */
0x0000, 0x0004, 0x0000, 0x0004, 0x0008, 0x0000, 0x0000, 0x0000,
/* -- < -- */
0x0002, 0x0004, 0x0008, 0x0004, 0x0002, 0x0000, 0x0000, 0x0000,
/* -- = -- */
0x0000, 0x000E, 0x0000, 0x000E, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- > -- */
0x0008, 0x0004, 0x0002, 0x0004, 0x0008, 0x0000, 0x0000, 0x0000,
/* -- ? -- */
0x001F, 0x0001, 0x0007, 0x0000, 0x0004, 0x0000, 0x0000, 0x0000,
/* -- @ -- */
0x001F, 0x0011, 0x0017, 0x0010, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- a -- */
0x001F, 0x0011, 0x001F, 0x0011, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- b -- */
0x001E, 0x0011, 0x001F, 0x0011, 0x001E, 0x0000, 0x0000, 0x0000,
/* -- c -- */
0x001F, 0x0010, 0x0010, 0x0010, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- d -- */
0x001E, 0x0011, 0x0011, 0x0011, 0x001E, 0x0000, 0x0000, 0x0000,
/* -- e -- */
0x001F, 0x0010, 0x001E, 0x0010, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- f -- */
0x001F, 0x0010, 0x001E, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000,
/* -- g -- */
0x001F, 0x0010, 0x0017, 0x0011, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- h -- */
0x0011, 0x0011, 0x001F, 0x0011, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- i -- */
0x000E, 0x0004, 0x0004, 0x0004, 0x000E, 0x0000, 0x0000, 0x0000,
/* -- j -- */
0x001F, 0x0001, 0x0001, 0x0011, 0x000E, 0x0000, 0x0000, 0x0000,
/* -- k -- */
0x0011, 0x0012, 0x001C, 0x0012, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- l -- */
0x0010, 0x0010, 0x0010, 0x0010, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- m -- */
0x0011, 0x001B, 0x0015, 0x0015, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- n -- */
0x0011, 0x0019, 0x0015, 0x0013, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- o -- */
0x001F, 0x0011, 0x0011, 0x0011, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- p -- */
0x001F, 0x0011, 0x001F, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000,
/* -- q -- */
0x001F, 0x0011, 0x0011, 0x0013, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- r -- */
0x001F, 0x0011, 0x001F, 0x0012, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- s -- */
0x001F, 0x0010, 0x001F, 0x0001, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- t -- */
0x001F, 0x0004, 0x0004, 0x0004, 0x0004, 0x0000, 0x0000, 0x0000,
/* -- u -- */
0x0011, 0x0011, 0x0011, 0x0011, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- v -- */
0x0011, 0x0011, 0x0011, 0x000A, 0x0004, 0x0000, 0x0000, 0x0000,
/* -- w -- */
0x0015, 0x0015, 0x0015, 0x0015, 0x000A, 0x0000, 0x0000, 0x0000,
/* -- x -- */
0x0011, 0x000A, 0x0004, 0x000A, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- y -- */
0x0011, 0x000A, 0x0004, 0x0004, 0x0004, 0x0000, 0x0000, 0x0000,
/* -- z -- */
0x001F, 0x0002, 0x0004, 0x0008, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- [ -- */
0x0006, 0x0004, 0x0004, 0x0004, 0x0006, 0x0000, 0x0000, 0x0000,
/* -- \ -- */
0x0010, 0x0008, 0x0004, 0x0002, 0x0001, 0x0000, 0x0000, 0x0000,
/* -- ] -- */
0x000C, 0x0004, 0x0004, 0x0004, 0x000C, 0x0000, 0x0000, 0x0000,
/* -- ^ -- */
0x0004, 0x000A, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- _ -- */
0x0000, 0x0000, 0x0000, 0x0000, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- ` -- */
0x0004, 0x0002, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* -- A - */
0x001F, 0x0011, 0x001F, 0x0011, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- B -- */
0x001E, 0x0011, 0x001F, 0x0011, 0x001E, 0x0000, 0x0000, 0x0000,
/* -- C -- */
0x001F, 0x0010, 0x0010, 0x0010, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- D -- */
0x001E, 0x0011, 0x0011, 0x0011, 0x001E, 0x0000, 0x0000, 0x0000,
/* -- E -- */
0x001F, 0x0010, 0x001E, 0x0010, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- F -- */
0x001F, 0x0010, 0x001E, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000,
/* -- G -- */
0x001F, 0x0010, 0x0017, 0x0011, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- H -- */
0x0011, 0x0011, 0x001F, 0x0011, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- I -- */
0x000E, 0x0004, 0x0004, 0x0004, 0x000E, 0x0000, 0x0000, 0x0000,
/* -- J -- */
0x001F, 0x0001, 0x0001, 0x0011, 0x000E, 0x0000, 0x0000, 0x0000,
/* -- K -- */
0x0011, 0x0012, 0x001C, 0x0012, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- L -- */
0x0010, 0x0010, 0x0010, 0x0010, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- M -- */
0x0011, 0x001B, 0x0015, 0x0015, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- N -- */
0x0011, 0x0019, 0x0015, 0x0013, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- O -- */
0x001F, 0x0011, 0x0011, 0x0011, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- P -- */
0x001F, 0x0011, 0x001F, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000,
/* -- Q -- */
0x001F, 0x0011, 0x0011, 0x0013, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- R -- */
0x001F, 0x0011, 0x001F, 0x0012, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- S -- */
0x001F, 0x0010, 0x001F, 0x0001, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- T -- */
0x001F, 0x0004, 0x0004, 0x0004, 0x0004, 0x0000, 0x0000, 0x0000,
/* -- U -- */
0x0011, 0x0011, 0x0011, 0x0011, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- V -- */
0x0011, 0x0011, 0x0011, 0x000A, 0x0004, 0x0000, 0x0000, 0x0000,
/* -- W -- */
0x0015, 0x0015, 0x0015, 0x0015, 0x000A, 0x0000, 0x0000, 0x0000,
/* -- X -- */
0x0011, 0x000A, 0x0004, 0x000A, 0x0011, 0x0000, 0x0000, 0x0000,
/* -- Y -- */
0x0011, 0x000A, 0x0004, 0x0004, 0x0004, 0x0000, 0x0000, 0x0000,
/* -- Z -- */
0x001F, 0x0002, 0x0004, 0x0008, 0x001F, 0x0000, 0x0000, 0x0000,
/* -- EOF -- */
};
and at the end of the file : FontDef Font_5x8 = {5,8,Font5x8};
I get not problem for compiling… but this font does not display on the OLED.