Sharp LCD library forked to use a Lucida 8 pt font
Fork of SharpLCD by
Diff: dotfont.c
- Revision:
- 6:ed1a32ac4a1c
- Child:
- 7:4737b3b2ed50
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dotfont.c Tue Apr 28 11:54:51 2015 +0000 @@ -0,0 +1,77 @@ +#include <string.h> +#include <stddef.h> + +#include "dotfont.h" + +extern const uint8_t lucidaConsole_8ptmaps[]; +extern const FONT_CHAR_INFO lucidaConsole_8ptDescs[]; +extern const uint8_t comicSansMS_10ptBitmaps[]; +extern const FONT_CHAR_INFO comicSansMS_10ptDescriptors[]; +extern const uint8_t sFSquareHead_10ptBitmaps[]; +extern const FONT_CHAR_INFO sFSquareHead_10ptDescriptors[]; +extern const uint8_t sFSquareHead_16ptBitmaps[]; +extern const uint8_t sFSquareHead_16ptBlackBitmaps[]; +extern const FONT_CHAR_INFO sFSquareHead_16ptDescriptors[]; + +/* Accumulation of all avaialble fonts */ +const FONT_INFO dotfonts[] = { + + { + "Lucida 8pt", + 8, /* pointSize */ + lucidaConsole_8ptDescs, + lucidaConsole_8ptmaps + }, + { + "Comic Sans 10pt", + 10, /* pointSize */ + comicSansMS_10ptDescriptors, + comicSansMS_10ptBitmaps + }, + { + "Square Head 10pt", + 10, /* pointSize */ + sFSquareHead_10ptDescriptors, + sFSquareHead_10ptBitmaps + }, + { + "Square Head 16pt", + 16, /* pointSize */ + sFSquareHead_16ptDescriptors, + sFSquareHead_16ptBitmaps + }, + { + "Square Head 16pt Black", + 16, /* pointSize */ + sFSquareHead_16ptDescriptors, + sFSquareHead_16ptBlackBitmaps + }, + + + + /* sentinel value */ + { + NULL, + 0, + NULL, + NULL + } +}; + + +const FONT_INFO * +searchFontFace(const char *familyName, + unsigned int pointSize) +{ + unsigned fontIndex; + + for (fontIndex = 0; dotfonts[fontIndex].familyName != NULL; fontIndex++) { + if ((strcmp(dotfonts[fontIndex].familyName, familyName) == 0) && + (dotfonts[fontIndex].pointSize == pointSize)) { + /* found it! */ + return (&dotfonts[fontIndex]); + } + } + + return (NULL); +} \ No newline at end of file