Demo Team / SharpLCD_LucidaFont

Fork of SharpLCD by Rohit Grover

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dotfont.c Source File

dotfont.c

00001 #include <string.h>
00002 #include <stddef.h>
00003 
00004 #include "dotfont.h"
00005 
00006 extern const uint8_t lucidaConsole_8ptmaps[];
00007 extern const FONT_CHAR_INFO lucidaConsole_8ptDescs[];
00008 extern const uint8_t comicSansMS_10ptBitmaps[];
00009 extern const FONT_CHAR_INFO comicSansMS_10ptDescriptors[];
00010 extern const uint8_t sFSquareHead_8ptBlackBitmaps[];
00011 extern const FONT_CHAR_INFO sFSquareHead_8ptDescriptors[];
00012 extern const uint8_t sFSquareHead_10ptBitmaps[];
00013 extern const uint8_t sFSquareHead_10ptBlackBitmaps[];
00014 extern const FONT_CHAR_INFO sFSquareHead_10ptDescriptors[];
00015 extern const uint8_t sFSquareHead_16ptBitmaps[];
00016 extern const uint8_t sFSquareHead_16ptBlackBitmaps[];
00017 extern const FONT_CHAR_INFO sFSquareHead_16ptDescriptors[];
00018 extern const uint8_t sFSquareHead_20ptBlackBitmaps[];
00019 extern const FONT_CHAR_INFO sFSquareHead_20ptDescriptors[];
00020 extern const uint8_t centuryGothic_9ptBlackBitmaps[];
00021 extern const FONT_CHAR_INFO centuryGothic_9ptDescriptors[];
00022 extern const uint8_t centuryGothic_20ptBlackBitmaps[];
00023 extern const FONT_CHAR_INFO centuryGothic_20ptDescriptors[];
00024 extern const uint8_t centuryGothic_28ptBlackBitmaps[];
00025 extern const FONT_CHAR_INFO centuryGothic_28ptDescriptors[];
00026 extern const uint8_t droidSansMono_9ptBlackBitmaps[];
00027 extern const FONT_CHAR_INFO droidSansMono_9ptDescriptors[];
00028 
00029 /* Accumulation of all avaialble fonts */
00030 const FONT_INFO dotfonts[] = {
00031 
00032     {
00033         "Lucida",
00034         8,   /* pointSize */
00035         1,   /* spacing */
00036         lucidaConsole_8ptDescs,
00037         lucidaConsole_8ptmaps
00038     },
00039     {
00040         "Comic Sans",
00041         10,   /* pointSize */
00042         2,   /* spacing */
00043         comicSansMS_10ptDescriptors,
00044         comicSansMS_10ptBitmaps
00045     },
00046     {
00047         "Square Head Black",
00048         8,   /* pointSize */
00049         2,   /* spacing */
00050         sFSquareHead_8ptDescriptors,
00051         sFSquareHead_8ptBlackBitmaps
00052     },
00053     {
00054         "Square Head",
00055         10,   /* pointSize */
00056         2,   /* spacing */
00057         sFSquareHead_10ptDescriptors,
00058         sFSquareHead_10ptBitmaps
00059     },
00060     {
00061         "Square Head Black",
00062         10,   /* pointSize */
00063         2,   /* spacing */
00064         sFSquareHead_10ptDescriptors,
00065         sFSquareHead_10ptBlackBitmaps
00066     },
00067     {
00068         "Square Head",
00069         16,   /* pointSize */
00070         2,   /* spacing */
00071         sFSquareHead_16ptDescriptors,
00072         sFSquareHead_16ptBitmaps
00073     },
00074     {
00075         "Square Head Black",
00076         16,   /* pointSize */
00077         2,   /* spacing */
00078         sFSquareHead_16ptDescriptors,
00079         sFSquareHead_16ptBlackBitmaps
00080     },
00081     {
00082         "Square Head Black",
00083         20,   /* pointSize */
00084         2,   /* spacing */
00085         sFSquareHead_20ptDescriptors,
00086         sFSquareHead_20ptBlackBitmaps
00087     },
00088     {
00089         "Century Gothic Black",
00090         9,   /* pointSize */
00091         2,   /* spacing */
00092         centuryGothic_9ptDescriptors,
00093         centuryGothic_9ptBlackBitmaps
00094     },
00095     {
00096         "Century Gothic Black",
00097         20,   /* pointSize */
00098         2,   /* spacing */
00099         centuryGothic_20ptDescriptors,
00100         centuryGothic_20ptBlackBitmaps
00101     },
00102     {
00103         "Century Gothic Black",
00104         28,   /* pointSize */
00105         2,   /* spacing */
00106         centuryGothic_28ptDescriptors,
00107         centuryGothic_28ptBlackBitmaps
00108     },
00109     {
00110         "Droid Sans Mono Black",
00111         9,   /* pointSize */
00112         0,   /* spacing */
00113         droidSansMono_9ptDescriptors,
00114         droidSansMono_9ptBlackBitmaps
00115     },
00116     
00117 
00118         
00119     /* sentinel value */
00120     {
00121         NULL,
00122         0,
00123         NULL,
00124         NULL
00125     }
00126 };
00127 
00128 
00129 const FONT_INFO *
00130 searchFontFace(const char  *familyName,
00131                unsigned int pointSize)
00132 {
00133     unsigned fontIndex;
00134 
00135     for (fontIndex = 0; dotfonts[fontIndex].familyName != NULL; fontIndex++) {
00136         if ((strcmp(dotfonts[fontIndex].familyName, familyName) == 0) &&
00137             (dotfonts[fontIndex].pointSize == pointSize)) {
00138             /* found it! */
00139             return (&dotfonts[fontIndex]);
00140         }
00141     }
00142 
00143     return (NULL);
00144 }