Sharp LCD library forked to use a Lucida 8 pt font
Fork of SharpLCD by
dotfont.c@6:ed1a32ac4a1c, 2015-04-28 (annotated)
- Committer:
- pwright01
- Date:
- Tue Apr 28 11:54:51 2015 +0000
- Revision:
- 6:ed1a32ac4a1c
- Child:
- 7:4737b3b2ed50
New font system
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pwright01 | 6:ed1a32ac4a1c | 1 | #include <string.h> |
pwright01 | 6:ed1a32ac4a1c | 2 | #include <stddef.h> |
pwright01 | 6:ed1a32ac4a1c | 3 | |
pwright01 | 6:ed1a32ac4a1c | 4 | #include "dotfont.h" |
pwright01 | 6:ed1a32ac4a1c | 5 | |
pwright01 | 6:ed1a32ac4a1c | 6 | extern const uint8_t lucidaConsole_8ptmaps[]; |
pwright01 | 6:ed1a32ac4a1c | 7 | extern const FONT_CHAR_INFO lucidaConsole_8ptDescs[]; |
pwright01 | 6:ed1a32ac4a1c | 8 | extern const uint8_t comicSansMS_10ptBitmaps[]; |
pwright01 | 6:ed1a32ac4a1c | 9 | extern const FONT_CHAR_INFO comicSansMS_10ptDescriptors[]; |
pwright01 | 6:ed1a32ac4a1c | 10 | extern const uint8_t sFSquareHead_10ptBitmaps[]; |
pwright01 | 6:ed1a32ac4a1c | 11 | extern const FONT_CHAR_INFO sFSquareHead_10ptDescriptors[]; |
pwright01 | 6:ed1a32ac4a1c | 12 | extern const uint8_t sFSquareHead_16ptBitmaps[]; |
pwright01 | 6:ed1a32ac4a1c | 13 | extern const uint8_t sFSquareHead_16ptBlackBitmaps[]; |
pwright01 | 6:ed1a32ac4a1c | 14 | extern const FONT_CHAR_INFO sFSquareHead_16ptDescriptors[]; |
pwright01 | 6:ed1a32ac4a1c | 15 | |
pwright01 | 6:ed1a32ac4a1c | 16 | /* Accumulation of all avaialble fonts */ |
pwright01 | 6:ed1a32ac4a1c | 17 | const FONT_INFO dotfonts[] = { |
pwright01 | 6:ed1a32ac4a1c | 18 | |
pwright01 | 6:ed1a32ac4a1c | 19 | { |
pwright01 | 6:ed1a32ac4a1c | 20 | "Lucida 8pt", |
pwright01 | 6:ed1a32ac4a1c | 21 | 8, /* pointSize */ |
pwright01 | 6:ed1a32ac4a1c | 22 | lucidaConsole_8ptDescs, |
pwright01 | 6:ed1a32ac4a1c | 23 | lucidaConsole_8ptmaps |
pwright01 | 6:ed1a32ac4a1c | 24 | }, |
pwright01 | 6:ed1a32ac4a1c | 25 | { |
pwright01 | 6:ed1a32ac4a1c | 26 | "Comic Sans 10pt", |
pwright01 | 6:ed1a32ac4a1c | 27 | 10, /* pointSize */ |
pwright01 | 6:ed1a32ac4a1c | 28 | comicSansMS_10ptDescriptors, |
pwright01 | 6:ed1a32ac4a1c | 29 | comicSansMS_10ptBitmaps |
pwright01 | 6:ed1a32ac4a1c | 30 | }, |
pwright01 | 6:ed1a32ac4a1c | 31 | { |
pwright01 | 6:ed1a32ac4a1c | 32 | "Square Head 10pt", |
pwright01 | 6:ed1a32ac4a1c | 33 | 10, /* pointSize */ |
pwright01 | 6:ed1a32ac4a1c | 34 | sFSquareHead_10ptDescriptors, |
pwright01 | 6:ed1a32ac4a1c | 35 | sFSquareHead_10ptBitmaps |
pwright01 | 6:ed1a32ac4a1c | 36 | }, |
pwright01 | 6:ed1a32ac4a1c | 37 | { |
pwright01 | 6:ed1a32ac4a1c | 38 | "Square Head 16pt", |
pwright01 | 6:ed1a32ac4a1c | 39 | 16, /* pointSize */ |
pwright01 | 6:ed1a32ac4a1c | 40 | sFSquareHead_16ptDescriptors, |
pwright01 | 6:ed1a32ac4a1c | 41 | sFSquareHead_16ptBitmaps |
pwright01 | 6:ed1a32ac4a1c | 42 | }, |
pwright01 | 6:ed1a32ac4a1c | 43 | { |
pwright01 | 6:ed1a32ac4a1c | 44 | "Square Head 16pt Black", |
pwright01 | 6:ed1a32ac4a1c | 45 | 16, /* pointSize */ |
pwright01 | 6:ed1a32ac4a1c | 46 | sFSquareHead_16ptDescriptors, |
pwright01 | 6:ed1a32ac4a1c | 47 | sFSquareHead_16ptBlackBitmaps |
pwright01 | 6:ed1a32ac4a1c | 48 | }, |
pwright01 | 6:ed1a32ac4a1c | 49 | |
pwright01 | 6:ed1a32ac4a1c | 50 | |
pwright01 | 6:ed1a32ac4a1c | 51 | |
pwright01 | 6:ed1a32ac4a1c | 52 | /* sentinel value */ |
pwright01 | 6:ed1a32ac4a1c | 53 | { |
pwright01 | 6:ed1a32ac4a1c | 54 | NULL, |
pwright01 | 6:ed1a32ac4a1c | 55 | 0, |
pwright01 | 6:ed1a32ac4a1c | 56 | NULL, |
pwright01 | 6:ed1a32ac4a1c | 57 | NULL |
pwright01 | 6:ed1a32ac4a1c | 58 | } |
pwright01 | 6:ed1a32ac4a1c | 59 | }; |
pwright01 | 6:ed1a32ac4a1c | 60 | |
pwright01 | 6:ed1a32ac4a1c | 61 | |
pwright01 | 6:ed1a32ac4a1c | 62 | const FONT_INFO * |
pwright01 | 6:ed1a32ac4a1c | 63 | searchFontFace(const char *familyName, |
pwright01 | 6:ed1a32ac4a1c | 64 | unsigned int pointSize) |
pwright01 | 6:ed1a32ac4a1c | 65 | { |
pwright01 | 6:ed1a32ac4a1c | 66 | unsigned fontIndex; |
pwright01 | 6:ed1a32ac4a1c | 67 | |
pwright01 | 6:ed1a32ac4a1c | 68 | for (fontIndex = 0; dotfonts[fontIndex].familyName != NULL; fontIndex++) { |
pwright01 | 6:ed1a32ac4a1c | 69 | if ((strcmp(dotfonts[fontIndex].familyName, familyName) == 0) && |
pwright01 | 6:ed1a32ac4a1c | 70 | (dotfonts[fontIndex].pointSize == pointSize)) { |
pwright01 | 6:ed1a32ac4a1c | 71 | /* found it! */ |
pwright01 | 6:ed1a32ac4a1c | 72 | return (&dotfonts[fontIndex]); |
pwright01 | 6:ed1a32ac4a1c | 73 | } |
pwright01 | 6:ed1a32ac4a1c | 74 | } |
pwright01 | 6:ed1a32ac4a1c | 75 | |
pwright01 | 6:ed1a32ac4a1c | 76 | return (NULL); |
pwright01 | 6:ed1a32ac4a1c | 77 | } |