]> git.karo-electronics.de Git - oswald.git/blob - ui/Fonts.h
Add MetaWatch Fonts package, LcdDisplay and start demo
[oswald.git] / ui / Fonts.h
1 //==============================================================================
2 //  Copyright 2011 Meta Watch Ltd. - http://www.MetaWatch.org/
3 // 
4 //  Licensed under the Meta Watch License, Version 1.0 (the "License");
5 //  you may not use this file except in compliance with the License.
6 //  You may obtain a copy of the License at
7 //  
8 //      http://www.MetaWatch.org/licenses/license-1.0.html
9 //
10 //  Unless required by applicable law or agreed to in writing, software
11 //  distributed under the License is distributed on an "AS IS" BASIS,
12 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 //  See the License for the specific language governing permissions and
14 //  limitations under the License.
15 //==============================================================================
16
17 /******************************************************************************/
18 /*! \file Fonts.h
19 *
20 * Fonts functions common to OLED and LCD version
21 *
22 * LCD is ROW based, OLED is column based
23 */
24 /******************************************************************************/
25
26 #ifndef FONTS_H
27 #define FONTS_H
28
29 /*! There are three fonts defined for the MetaWatch LCD 
30  * they are 5, 7 and 16 pixels tall with variable width
31  */
32 typedef enum 
33 {
34   MetaWatch5,
35   MetaWatch7,
36   MetaWatch16,
37   MetaWatchTime,
38   MetaWatch5Oled,
39   MetaWatch7Oled,
40   MetaWatch16Oled,
41   MetaWatchIconOled
42   
43 } etFontType;
44
45 /*! Use to size the bitmap used in the Display Task for printing characters FOR 
46  * THE LCD VERSION
47  */
48 #define MAX_FONT_ROWS ( 19 )
49
50 /*! The maximum number of columns any font (or icon) requires.  This is 
51  * used to define the size of the bitmap passed into font functions FOR THE
52  * OLED version
53  */
54 #define MAX_FONT_COLUMNS ( 30 )
55
56 #define TOTAL_TIME_CHARACTERS      ( 12 )
57 #define TIME_CHARACTER_COLON_INDEX ( 10 )
58 #define TIME_CHARACTER_SPACE_INDEX ( 11 )
59
60 /*! Convert a character into an index into the font table
61  *
62  * \param CharIn is the input character
63  * \return Index into the table
64  */
65 unsigned char MapCharacterToIndex(unsigned char CharIn);
66
67 /*! Convert a digit (0-9) into an index into the font table
68  *
69  * \param Digit is a number
70  * \return Index into the table
71  */
72 unsigned char MapDigitToIndex(unsigned char Digit);
73
74 /*! Get the bitmap for the specified character
75  *
76  * \param Character is the desired character
77  * \param pBitmap pointer to an array of integers that holds the bitmap
78  *
79  * \note pBitmap must point to an object large enough to hold the largest bitmap
80  * 
81  * \note For the LCD bitmaps the font height is the same as number of rows. 
82  * If the width is less than 8 then each row is a byte.
83  * If the width is less than 16 but > 8 then each row is a word.
84  * The function works with ints so that it is generic for both types
85  *
86  */
87 void GetCharacterBitmap(unsigned char Character,unsigned int * pBitmap);
88
89 /*! Get the width for a specified character *
90  *
91  * \param Character is the desired character
92  * \return Width of character in columns
93  */
94 unsigned char GetCharacterWidth(unsigned char Character);
95
96 /*! Set the font type used for future Get operations *
97  *
98  * \param Type of font
99  */
100 void SetFont(etFontType Type);
101
102 /*! Set the font spacing for the current font*
103  *
104  * \param Spacing is the number of columns between characters
105  *
106  * \note The characters do not have any 'natural' spacing between them
107  */
108 void SetFontSpacing(unsigned char Spacing);
109
110 /*! 
111  * \return The font spacing in columns 
112  */
113 unsigned char GetFontSpacing(void);
114
115
116 /*! 
117  * \return The font height in rows 
118  */
119 unsigned char GetCharacterHeight(void);
120
121 #endif /*FONTS_H*/