Sharp LCD library forked to use a Lucida 8 pt font

Fork of SharpLCD by Rohit Grover

Committer:
pwright01
Date:
Wed May 13 08:14:07 2015 +0000
Revision:
9:fc71206a6b64
Parent:
7:4737b3b2ed50
new fonts

Who changed what in which revision?

UserRevisionLine numberNew 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[];
andcor02 7:4737b3b2ed50 10 extern const uint8_t sFSquareHead_8ptBlackBitmaps[];
andcor02 7:4737b3b2ed50 11 extern const FONT_CHAR_INFO sFSquareHead_8ptDescriptors[];
pwright01 6:ed1a32ac4a1c 12 extern const uint8_t sFSquareHead_10ptBitmaps[];
andcor02 7:4737b3b2ed50 13 extern const uint8_t sFSquareHead_10ptBlackBitmaps[];
pwright01 6:ed1a32ac4a1c 14 extern const FONT_CHAR_INFO sFSquareHead_10ptDescriptors[];
pwright01 6:ed1a32ac4a1c 15 extern const uint8_t sFSquareHead_16ptBitmaps[];
pwright01 6:ed1a32ac4a1c 16 extern const uint8_t sFSquareHead_16ptBlackBitmaps[];
pwright01 6:ed1a32ac4a1c 17 extern const FONT_CHAR_INFO sFSquareHead_16ptDescriptors[];
andcor02 7:4737b3b2ed50 18 extern const uint8_t sFSquareHead_20ptBlackBitmaps[];
andcor02 7:4737b3b2ed50 19 extern const FONT_CHAR_INFO sFSquareHead_20ptDescriptors[];
andcor02 7:4737b3b2ed50 20 extern const uint8_t centuryGothic_9ptBlackBitmaps[];
andcor02 7:4737b3b2ed50 21 extern const FONT_CHAR_INFO centuryGothic_9ptDescriptors[];
andcor02 7:4737b3b2ed50 22 extern const uint8_t centuryGothic_20ptBlackBitmaps[];
andcor02 7:4737b3b2ed50 23 extern const FONT_CHAR_INFO centuryGothic_20ptDescriptors[];
andcor02 7:4737b3b2ed50 24 extern const uint8_t centuryGothic_28ptBlackBitmaps[];
andcor02 7:4737b3b2ed50 25 extern const FONT_CHAR_INFO centuryGothic_28ptDescriptors[];
pwright01 9:fc71206a6b64 26 extern const uint8_t droidSansMono_9ptBlackBitmaps[];
pwright01 9:fc71206a6b64 27 extern const FONT_CHAR_INFO droidSansMono_9ptDescriptors[];
pwright01 6:ed1a32ac4a1c 28
pwright01 6:ed1a32ac4a1c 29 /* Accumulation of all avaialble fonts */
pwright01 6:ed1a32ac4a1c 30 const FONT_INFO dotfonts[] = {
pwright01 6:ed1a32ac4a1c 31
pwright01 6:ed1a32ac4a1c 32 {
andcor02 7:4737b3b2ed50 33 "Lucida",
pwright01 6:ed1a32ac4a1c 34 8, /* pointSize */
pwright01 9:fc71206a6b64 35 1, /* spacing */
pwright01 6:ed1a32ac4a1c 36 lucidaConsole_8ptDescs,
pwright01 6:ed1a32ac4a1c 37 lucidaConsole_8ptmaps
pwright01 6:ed1a32ac4a1c 38 },
pwright01 6:ed1a32ac4a1c 39 {
andcor02 7:4737b3b2ed50 40 "Comic Sans",
pwright01 6:ed1a32ac4a1c 41 10, /* pointSize */
pwright01 9:fc71206a6b64 42 2, /* spacing */
pwright01 6:ed1a32ac4a1c 43 comicSansMS_10ptDescriptors,
pwright01 6:ed1a32ac4a1c 44 comicSansMS_10ptBitmaps
pwright01 6:ed1a32ac4a1c 45 },
pwright01 6:ed1a32ac4a1c 46 {
andcor02 7:4737b3b2ed50 47 "Square Head Black",
andcor02 7:4737b3b2ed50 48 8, /* pointSize */
pwright01 9:fc71206a6b64 49 2, /* spacing */
andcor02 7:4737b3b2ed50 50 sFSquareHead_8ptDescriptors,
andcor02 7:4737b3b2ed50 51 sFSquareHead_8ptBlackBitmaps
andcor02 7:4737b3b2ed50 52 },
andcor02 7:4737b3b2ed50 53 {
andcor02 7:4737b3b2ed50 54 "Square Head",
pwright01 6:ed1a32ac4a1c 55 10, /* pointSize */
pwright01 9:fc71206a6b64 56 2, /* spacing */
pwright01 6:ed1a32ac4a1c 57 sFSquareHead_10ptDescriptors,
pwright01 6:ed1a32ac4a1c 58 sFSquareHead_10ptBitmaps
pwright01 6:ed1a32ac4a1c 59 },
pwright01 6:ed1a32ac4a1c 60 {
andcor02 7:4737b3b2ed50 61 "Square Head Black",
andcor02 7:4737b3b2ed50 62 10, /* pointSize */
pwright01 9:fc71206a6b64 63 2, /* spacing */
andcor02 7:4737b3b2ed50 64 sFSquareHead_10ptDescriptors,
andcor02 7:4737b3b2ed50 65 sFSquareHead_10ptBlackBitmaps
andcor02 7:4737b3b2ed50 66 },
andcor02 7:4737b3b2ed50 67 {
andcor02 7:4737b3b2ed50 68 "Square Head",
pwright01 6:ed1a32ac4a1c 69 16, /* pointSize */
pwright01 9:fc71206a6b64 70 2, /* spacing */
pwright01 6:ed1a32ac4a1c 71 sFSquareHead_16ptDescriptors,
pwright01 6:ed1a32ac4a1c 72 sFSquareHead_16ptBitmaps
pwright01 6:ed1a32ac4a1c 73 },
pwright01 6:ed1a32ac4a1c 74 {
andcor02 7:4737b3b2ed50 75 "Square Head Black",
pwright01 6:ed1a32ac4a1c 76 16, /* pointSize */
pwright01 9:fc71206a6b64 77 2, /* spacing */
pwright01 6:ed1a32ac4a1c 78 sFSquareHead_16ptDescriptors,
pwright01 6:ed1a32ac4a1c 79 sFSquareHead_16ptBlackBitmaps
pwright01 6:ed1a32ac4a1c 80 },
andcor02 7:4737b3b2ed50 81 {
andcor02 7:4737b3b2ed50 82 "Square Head Black",
andcor02 7:4737b3b2ed50 83 20, /* pointSize */
pwright01 9:fc71206a6b64 84 2, /* spacing */
andcor02 7:4737b3b2ed50 85 sFSquareHead_20ptDescriptors,
andcor02 7:4737b3b2ed50 86 sFSquareHead_20ptBlackBitmaps
andcor02 7:4737b3b2ed50 87 },
andcor02 7:4737b3b2ed50 88 {
andcor02 7:4737b3b2ed50 89 "Century Gothic Black",
andcor02 7:4737b3b2ed50 90 9, /* pointSize */
pwright01 9:fc71206a6b64 91 2, /* spacing */
andcor02 7:4737b3b2ed50 92 centuryGothic_9ptDescriptors,
andcor02 7:4737b3b2ed50 93 centuryGothic_9ptBlackBitmaps
andcor02 7:4737b3b2ed50 94 },
andcor02 7:4737b3b2ed50 95 {
andcor02 7:4737b3b2ed50 96 "Century Gothic Black",
andcor02 7:4737b3b2ed50 97 20, /* pointSize */
pwright01 9:fc71206a6b64 98 2, /* spacing */
andcor02 7:4737b3b2ed50 99 centuryGothic_20ptDescriptors,
andcor02 7:4737b3b2ed50 100 centuryGothic_20ptBlackBitmaps
andcor02 7:4737b3b2ed50 101 },
andcor02 7:4737b3b2ed50 102 {
andcor02 7:4737b3b2ed50 103 "Century Gothic Black",
andcor02 7:4737b3b2ed50 104 28, /* pointSize */
pwright01 9:fc71206a6b64 105 2, /* spacing */
andcor02 7:4737b3b2ed50 106 centuryGothic_28ptDescriptors,
andcor02 7:4737b3b2ed50 107 centuryGothic_28ptBlackBitmaps
andcor02 7:4737b3b2ed50 108 },
pwright01 9:fc71206a6b64 109 {
pwright01 9:fc71206a6b64 110 "Droid Sans Mono Black",
pwright01 9:fc71206a6b64 111 9, /* pointSize */
pwright01 9:fc71206a6b64 112 0, /* spacing */
pwright01 9:fc71206a6b64 113 droidSansMono_9ptDescriptors,
pwright01 9:fc71206a6b64 114 droidSansMono_9ptBlackBitmaps
pwright01 9:fc71206a6b64 115 },
pwright01 6:ed1a32ac4a1c 116
pwright01 6:ed1a32ac4a1c 117
pwright01 6:ed1a32ac4a1c 118
pwright01 6:ed1a32ac4a1c 119 /* sentinel value */
pwright01 6:ed1a32ac4a1c 120 {
pwright01 6:ed1a32ac4a1c 121 NULL,
pwright01 6:ed1a32ac4a1c 122 0,
pwright01 6:ed1a32ac4a1c 123 NULL,
pwright01 6:ed1a32ac4a1c 124 NULL
pwright01 6:ed1a32ac4a1c 125 }
pwright01 6:ed1a32ac4a1c 126 };
pwright01 6:ed1a32ac4a1c 127
pwright01 6:ed1a32ac4a1c 128
pwright01 6:ed1a32ac4a1c 129 const FONT_INFO *
pwright01 6:ed1a32ac4a1c 130 searchFontFace(const char *familyName,
pwright01 6:ed1a32ac4a1c 131 unsigned int pointSize)
pwright01 6:ed1a32ac4a1c 132 {
pwright01 6:ed1a32ac4a1c 133 unsigned fontIndex;
pwright01 6:ed1a32ac4a1c 134
pwright01 6:ed1a32ac4a1c 135 for (fontIndex = 0; dotfonts[fontIndex].familyName != NULL; fontIndex++) {
pwright01 6:ed1a32ac4a1c 136 if ((strcmp(dotfonts[fontIndex].familyName, familyName) == 0) &&
pwright01 6:ed1a32ac4a1c 137 (dotfonts[fontIndex].pointSize == pointSize)) {
pwright01 6:ed1a32ac4a1c 138 /* found it! */
pwright01 6:ed1a32ac4a1c 139 return (&dotfonts[fontIndex]);
pwright01 6:ed1a32ac4a1c 140 }
pwright01 6:ed1a32ac4a1c 141 }
pwright01 6:ed1a32ac4a1c 142
pwright01 6:ed1a32ac4a1c 143 return (NULL);
pwright01 6:ed1a32ac4a1c 144 }